Can't run pyinstaller binaries

I have a Python project which builds a binary with pyinstaller.
Building works fine but I can’t run it afterwards.
The result is the following:

./todoist_interface 
bash: ./todoist_interface: No such file or directory

With steam-run I then get the following output, which I could work with:

Traceback (most recent call last):
  File "todoist_interface/__main__.py", line 1, in <module>
    import settings
ModuleNotFoundError: No module named 'settings'
[1046319] Failed to execute script __main__

hmmm, overriding phases … hmmm… when i’ve done that in other scenarios, it’s not been good for me.

Might be unrelated.

I don’t think I’m really overwriting them since I wrote the software in the first place 🤷

Looks like todoist_interface/todoist_interface at 33cc7cd058b5f892ece0765fc608f4de4d1c63ac · Nebucatnetzer/todoist_interface · GitHubmain.py#L1

Should be:
from . import settings

Otherwise import settings is just trying to find a settings.py or settings/__init__.py under a path in sys.path. I would assume that pyinstaller is setting the top-level of the project as the CWD before launching the python interpreter, so that should be located in sys.path; and by convention, the python interpreter add the CWD to sys.path.

2 Likes

Thanks for the tip, the script in general should work (at least it does on Ubuntu).
I’m actually more curios if I could run it without having to use steam-run.

Without knowing more about how its runtime behavior, I’m not sure.

You could try doing an autoPatchelfHook phase, and see if you can’t satisfy the top-level binary.

My concern is that it might be unpacking a bunch of stuff at runtime, and the binaries located inside won’t be nix compatible.

1 Like

I’ll give it a try.
You’re right it is a self extracting zip file which then contains the required code.
It’s the only way I know to make a binary from a Python script.
Wouldn’t mind to try a different way, if you know of one but maybe the autoPatch will already help.

I tried it but it still behaves the same, however I’m not sure that I’ve applied it correctly.