Skip to content

Fix broken file descriptors in frozen windows apps#628

Open
ndahn wants to merge 2 commits intospatialaudio:masterfrom
ndahn:master
Open

Fix broken file descriptors in frozen windows apps#628
ndahn wants to merge 2 commits intospatialaudio:masterfrom
ndahn:master

Conversation

@ndahn
Copy link
Copy Markdown

@ndahn ndahn commented Apr 22, 2026

Fixes #461.

ndahn added 2 commits April 22, 2026 23:41
Prevent stderr duplication issues in frozen context on Windows. Fixes spatialaudio#461.
Fix stderr handling for frozen Windows applications
Comment thread src/sounddevice.py
# Duping std file descriptors in a frozen context on windows will corrupt
# the fd and cause issues with e.g. subprocess.check_output. This happens
# for example in a compiled pyinstaller exe. See #461 for details.
if _sys.platform != 'win32' or not getattr(_sys, 'frozen', False):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably a matter of taste, but I think this would be easier to understand:

Suggested change
if _sys.platform != 'win32' or not getattr(_sys, 'frozen', False):
if not (_sys.platform == 'win32' and getattr(_sys, 'frozen', False)):

Or maybe you could do something like this:

    if _sys.platform == 'win32' and getattr(_sys, 'frozen', False):
        # the whole comment from above, explaining what's wrong in this case
        pass
    else:
        # the original redirection code

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to use subprocess.check_output with sounddevice 0.4.6

2 participants