The pyinstaller program does not work if it is built without a console

I have a small application that I am trying to create against window machines. The program creates an OpenVPN connection. If I create a program and run it, it first opens the console as the program output. If I pass the parameter -wto pyinstaller so as not to create it with the console connected, the program does not start at all. It opens completely, but the vpn connection is never created.

Everything works fine with the console.

I also have basic logging for the application to see where my code can stop and nothing is written. With the console in my program, all kinds of magazines spit out.

I just don’t know why my program can work perfectly with the console, but do nothing without it. Any ideas?

+5
source share
2 answers

I'm going to answer it myself. Make sure you are not printing anything, and also redirecting all stdout to a log, file or something else, and not to the console.

+4
source

I had a similar problem, but I could not find any print / stdout commands for the console. I used subprocess.Popen and redirect stdout = subprocess.PIPE. Subsequently, I added stderr = subprocess.STDOUT and stdin = subprocess.PIPE, and my program worked. This page ( Python subprocess.call () does not work when using pythonw.exe ) on subprocess crashes helped me get it to work.

+4
source

All Articles