Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When building a pyinstaller package on Windows with --windowed option, the packaged app fails to start #40

Open
andryghb opened this issue Jul 3, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@andryghb
Copy link

andryghb commented Jul 3, 2020

After investigating the reasons for such behaviour (without --windowed everything works fine), I narrowed it down to this part of code in _io.py

p = subprocess.Popen(
    cmd,
    stdin=subprocess.PIPE,
    stdout=subprocess.PIPE,
    stderr=None,
    **_popen_kwargs(prevent_sigint=True)
)

The comment that follows explains that stderr was deliberately set to None because if redirected to pipe on Windows, it causes ffmpeg to hang. On the other hand, stderr=None causes a problem with --windowed option on Windows (OSError: [WinError 6] The handle is invalid). My understanding is that Windows is trying to recreate stderr handle as it is set to None, but unable to do this due to --windowed mode.

A possible solution is to redirect stderr (and probably stdout too) to subprocess.DEVNULL instead of None, i.e.

stderr=subprocess.DEVNULL
@almarklein
Copy link
Member

Thanks for this report!

A possible solution is to redirect stderr (and probably stdout too) to subprocess.DEVNULL instead of None,

Interesting. have you tried whether this works for you?

@almarklein almarklein added the bug Something isn't working label Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants