0

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

1 Answer 1

1

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!

Sign up to request clarification or add additional context in comments.

1 Comment

But the error is not that thw problem is in pynput library ???????

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.