pyinstaller program not working if built without console

pyinstaller

Solution

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.

Problem

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?

Original source

Related problems