Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pyinstaller "Failed to execute script pyiboot01_bootstrap"

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.

like image 722
LukeDev Avatar asked Apr 20 '26 16:04

LukeDev


2 Answers

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.

like image 122
LukeDev Avatar answered Apr 23 '26 20:04

LukeDev


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.

like image 25
eeshankhan Avatar answered Apr 23 '26 20:04

eeshankhan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!