Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pyinstaller program not working if built without console

Tags:

pyinstaller

I have a small app that I'm trying to build against windows machines. The program creates an OpenVPN connection. If I build the program and run it it first opens a console as the program output. If I pass the -w parameter to pyinstaller to not build it with a console attached the program fails to run at all. It opens allright but the vpn connection is never created.

With the console everything works perfect.

I also have a basic logging for the application in place to see where my code might stop and nothing gets written. With console on my program spits out all kinds of logs.

I just don't know why my program could be performing perfectly with a console but doing nothing without one. Any ideas?

like image 391
Romeo Mihalcea Avatar asked Mar 11 '13 14:03

Romeo Mihalcea


People also ask

Why my PyInstaller is not working?

The most common reason a PyInstaller package fails is that PyInstaller failed to bundle a required file. Such missing files fall into a few categories: Hidden or missing imports: Sometimes PyInstaller can't detect the import of a package or library, typically because it is imported dynamically.

How do I get rid of the console in PyInstaller?

We can hide or avoid the console by specifying pyinstaller --oneline filename --windowed command.

Does PyInstaller work without Python?

They do not need to have Python installed at all. The output of PyInstaller is specific to the active operating system and the active version of Python. This means that to prepare a distribution for: a different OS.

Which is better PyInstaller or py2exe?

In PyInstaller it is easy to create one exe, By default both create a bunch of exes & dlls. In py2exe its easier to embed manifest file in exe, useful for run as administrator mode in windows vista and beyond. Pyinstaller is modular and has a feature of hooks to include files in the build that you like.


1 Answers

Gonna answer this myself. Make sure you don't print anything and also you redirect all stdout to a logger, file or whatever else instead of the console.

like image 75
Romeo Mihalcea Avatar answered Jan 01 '23 14:01

Romeo Mihalcea



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!