In a PyInstaller-frozen application without console (and onefile bundle), the _is_valid_exe always returns False; the subprocess.check_call() call always fails with OSError: [WinError 6] The handle is invalid because the inherited stdin handle is invalid (due to console being unavailable). Therefore, it should be redirected to devnull, like stdout and stderr are.
Also, use subprocess.DEVNULL instead of manually opening os.devnull.
In a
PyInstaller
-frozen application without console (and onefile bundle), the_is_valid_exe
always returnsFalse
; thesubprocess.check_call()
call always fails withOSError: [WinError 6] The handle is invalid
because the inheritedstdin
handle is invalid (due to console being unavailable). Therefore, it should be redirected todevnull
, likestdout
andstderr
are.Also, use
subprocess.DEVNULL
instead of manually openingos.devnull
.Fixes part of pyinstaller/pyinstaller#6236.