How do I disable PythonWin's “Redirecting output to win32trace remote collector” feature without uninstalling PythonWin?

▼魔方 西西 提交于 2019-12-11 06:28:31

问题


When I run a wxPython application, it prints the string “Redirecting output to win32trace remote collector”and I must open PythonWin's trace collector tool to view that trace output.

Since I'm not interested in collecting this output, how should I disable this feature?


回答1:


You can even pass that when you instantiate your wx.App():

if __name__ == "__main__":
    app = wx.App(redirect=False) #or 0
    app.MainLoop()

wxPython wx.App docs




回答2:


This message deceived me into thinking win32trace was preventing me from seeing uncaught exceptions in the regular console (of my IDE). The real issue was that wxPython by default redirects stdout/stderr to a popup window that quickly disappeared after an uncaught exception. To solve that problem, I simply had to pass

redirect=0
to the superclass constructor of my application.
class MyApp(wx.App):
    def __init__(self):
        # Prevent wxPython from redirecting stdout/stderr:
        super(MyApp, self).__init__(redirect=0)

That fix notwithstanding, I am still curious about how to control win32trace.




回答3:


It seems to be an Problem with TortoiseHG. It also happens when using win32gui.GetOpenFileNameW. Uninstalling solves this problem. Unfortunately i found no real solution how to fix this.



来源:https://stackoverflow.com/questions/306901/how-do-i-disable-pythonwins-redirecting-output-to-win32trace-remote-collector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!