Sound import prevents input() from functioning properly

I’m open for suggestions on how to improve this situation, ideally in the form of a pull request!

But it is probably not as bad as you might think. I’m not actually redirecting all of stderr. It’s only a part of it, but TBH, I don’t really know in which situation this could unintentionally silence the output of some other module. I guess it could be a problem with C extensions? But those shouldn’t generate any raw stderr messages anyway, right?

Python’s sys.stderr is not affected, nor is the stderr from an external process, as can be seen in this example:

import subprocess
import sys

import sounddevice as sd

print('no output, please press <return>')
input("I'm not visible!")
print('I am visible!', file=sys.stderr)
print('stderr from external program:')
subprocess.run(['cat', 'nonexisting-file.txt'])

BTW, the redirection of stderr is only done on Linux and macOS, so if you try this on Windows, the input prompt should be visible, whether sounddevice is imported or not. And cat will probably not be a valid command.

If anybody can come up with an example where stderr output is unintentionally hidden, please tell me!