Reputation: 11
Recently I've made a python app and when I change it to a exe
file it is saying Failed to execute script app
When I run it in console it is showing like this:
Traceback (most recent call last):
File "app.py", line 4, in <module>
File "C:\Users\DELL\AppData\Roaming\Python\Python39\site-
packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.__dict__)
File "pynput\__init__.py", line 40, in <module>
File "C:\Users\DELL\AppData\Roaming\Python\Python39\site-
packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.__dict__)
File "pynput\keyboard\__init__.py", line 31, in <module>
File "pynput\_util\__init__.py", line 76, in backend
ImportError
[104] Failed to execute script app
Upvotes: 0
Views: 598
Reputation: 29
So, What I did is I added an extra parameter --debug in the pyinstaller command and removing the --windowed parameter so that I can see what is actually happening when the app is clicked and I found out there was an error that made a lot of sense when I trace it, it basically complained that "some_image.jpg" no such file or directory.
The reason why it complains and didn't complain when I ran the script from the first place or even using the command line "./" is because the file image existed in the same path as the script located but when pyinstaller created "dist" directory which has the app product it makes a perfect sense that the image file is not there and so I basically moved it to that dist directory where the clickable app is there!
Upvotes: 1