def fix_windows_stdout_stderr():
"""
Processes can't write to stdout/stderr on frozen windows apps because they do not exist here
if process tries it anyway we get a nasty dialog window popping up, so we redirect the streams to a dummy
see https://github.com/jopohl/urh/issues/370
"""
if hasattr(sys, "frozen") and sys.platform == "win32":
try:
sys.stdout.write("\n")
sys.stdout.flush()
except:
class DummyStream(object):
def __init__(self): pass
def write(self, data): pass
def read(self, data): pass
def flush(self): pass
def close(self): pass
sys.stdout, sys.stderr, sys.stdin = DummyStream(), DummyStream(), DummyStream()
sys.__stdout__, sys.__stderr__, sys.__stdin__ = DummyStream(), DummyStream(), DummyStream()
评论列表
文章目录