App Command with Python Plugin

I’m writing a small snap using the python plugin and I’m struggling with the apps command section.

Right now I have the following:

    command: bin/python3 bin/broker
    daemon: simple

Where broker is a entry point that I created with

        "console_scripts": [

When I try to install this snap I get the following error:

File "/snap/governor-broker/x1/bin/broker", line 5, in <module>
   from import main
ModuleNotFoundError: No module named 'src'

going directly to the /snap directory of my snap I was able to execute this correctly by using the python3 binary located in the bin folder.

But when I state the following in my snapcraft.yaml:

    command: bin/python3 bin/broker
    daemon: simple

I get the follwoing error when building the snap:

Failed to generate snap metadata: The specified command 'bin/python3 bin/broker defined in the app 'governor-broker' is not executable.

What am I doing wrong here?

I just did a snapcraft clean and it builds successfully but fails afterwards with this mesage:

/snap/governor-broker/x2/bin/python3: can't open file 'bin/broker': [Errno 2] No such file or directory

I just realized I always have to use snapcraft clean before building, that fixed my issue.

I tried to remove the post but I think I messed it up.

1 Like

Ah, no worries. I see my previous post was answering a different problem anyway, so I’ll remove that one.

From what I recall, Snapcraft doesn’t always rerun the pull step if the executable bit is switched on the parts source, (I recall this specifically with the dump plugin with local folders, and it possibly occurs with others?) , which is why you’ll have had to have to run clean if you end up flipping the bit so the one actually in the .snap also has the bit set correctly.

I wouldn’t generally worry about removing the thread, maybe someone will Google a similar problem in the future and see this and it might help them out! That’s certainly most of my computer experience.

1 Like