compilation and console

28 views
Skip to first unread message

Itsik Weissman

unread,
Feb 17, 2021, 6:26:40 AM2/17/21
to pyins...@googlegroups.com
I have a script ‘mysoft.py’.
Compiling it with ‘pyinstaller –F –i icon.ico mysoft.py’ gives a good executable. It runs fine.
Compiling it with  ‘pyinstaller –F –w –i icon.ico mysoft.py’ gives a bad executable. When launching it, I get an error message “mysoft.py script failed to execute”.
Any idea how to fix this?
 
Yitzhak

bwoodsend

unread,
Feb 17, 2021, 12:10:31 PM2/17/21
to PyInstaller

Are you using subprocess anywhere (possibly indirectly through a dependency)? That’s the only case I know of where --windowed leads to breakages. It’s also worth verifying that pythonw mysoft.py works.

Yitzhak Weissman

unread,
Feb 22, 2021, 12:44:53 PM2/22/21
to PyInstaller
Thank you

Yitzhak Weissman

unread,
Feb 23, 2021, 4:50:05 AM2/23/21
to PyInstaller
I was actually using subprocess.

bwoodsend

unread,
Feb 23, 2021, 10:49:29 AM2/23/21
to PyInstaller

You can get around it by explicitly setting unused pipes to subprocess.DEVNULL rather than letting them default to inheriting an invalid pipe. So if you were using:

from subprocess import run, PIPE

run(["echo", "hello"], stdout=PIPE)

you should explicitly redirect the unused stdin and stderr to NULL:

from subprocess import run, PIPE, DEVNULL

run(["echo", "hello"], stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL)

Yitzhak Weissman

unread,
Feb 24, 2021, 9:37:16 AM2/24/21
to PyInstaller
I was actually using
current_machine_id = subprocess.check_output('wmic csproduct get uuid')

Reply all
Reply to author
Forward
0 new messages