3

I'm using pyinstaller to produce an exectuable for a python program. But, whenever I try to use a generated executable, I get a message window that reads "Failed to execute script ...".

The command I'm running is pyinstaller -w run.py. But, when run with the --debug option a different error is made apparent. "Failed to execute script pyiboot-1_bootstrap". After this error it kills the program.

I tried with the -F option and that did not change the outcome. All the files I created for the project are in the same directory. I did get warnings that dll's weren't being included but I resolved that.

LukeDev
  • 509
  • 4
  • 19

2 Answers2

6

Pyinstaller doesn't like the built in quit() function I was using.

Instead use sys.exit() to close the program.

See this question to see why sys.exit() is better practice for production code.

LukeDev
  • 509
  • 4
  • 19
5

What I found useful was to make an exe of my .py script in console mode and then run it. For a very short period of time, I saw an error message in the console window. I had to screenshot it to read completely. So one of the imports was missing from the folder in which I had my script. I opened cmd from the location bar of that folder (by typing cmd there) and imported modules using pip install <module_name>. Sorry for the long answer, I am a newbie.

eeshankhan
  • 51
  • 1
  • 1