Jamie Smith
Jamie Smith

Reputation: 105

Pyinstaller --windowed or --noconsole .exe not allowing chromedriver to open

I have a python program that I am converting to a .exe file. I have compiled with Pyinstaller and all is working fine. I now want to get rid of the console window as I have a pyqt user interface. I have tried:

pyinstaller --onefile --windowed --icon=favicon.ico main.py

Its compiling fine and running however when chromedriver is activated it doesnt show up. It works fine when i do not use --windowed or --noconsole.

Anyone had this problem before?

Thanks Jamie

Upvotes: 3

Views: 34022

Answers (4)

Dan A.S.
Dan A.S.

Reputation: 701

Change the extension of your main (GUI) file. From: *.py to *.pyw (Python officially supported).

Then: pyinstaller --onefile --noconsole main.pyw

This worked for me.

From pyinstaller.org:

for Windows a file extension of .pyw suppresses the console window that normally appears. Likewise, a console window will not be provided when using a myscript.pyw script with PyInstaller.

Upvotes: 1

خالد محمود
خالد محمود

Reputation: 388

I know that this question has been since 2016, but I would like to share my knowledge.

Try to put --noconsole before --onefile.

So, the command will be:

pyinstaller --noconsole --onefile --windowed --icon=favicon.ico main.py

Upvotes: 11

H S Umer farooq
H S Umer farooq

Reputation: 1081

In Python 2.7 use subprocess like this:

DEVNULL = open(os.devnull,"wb")
output = subprocess.check_output(command, shell=True,stderr=DEVNULL,stdin=DEVNULL)

In Python 3 use subprocess like this:

DEVNULL = subprocess.DEVNULL
output=subprocess.check_output(command,shell=True, stderr = DEVNULL , stdin = DEVNULL )

Hopefully it will solve your problem.

Upvotes: 2

syedelec
syedelec

Reputation: 1300

add --noconsole flag to your script call and remove --windowed, I tested this and it worked for me.

this would be :

pyinstaller --noconsole --icon=favicon.ico main.py

Upvotes: 1

Related Questions