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

StackOverflow https://stackoverflow.com/questions/306901

  •  08-07-2019
  •  | 
  •  

Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top