main.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:urh 作者: jopohl 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号