1

I'm running Python 2.7.13 via Anaconda on Windows 10, and trying to run the following code

import Tkinter, tkFileDialog

root = Tkinter.Tk()
root.withdraw()

file_path = tkFileDialog.askopenfilename()

(source: https://stackoverflow.com/a/14119223/1850917)

The code itself works fine, but the message Redirecting output to win32trace remote collector appears when I run the last command, and as it says, all output is redirected, so I am unable to print() etc.

Is there a way to disable this behaviour?

Filip S.
  • 1,514
  • 3
  • 19
  • 40
  • I have no idea how the program [odrive](https://www.odrive.com) is connected to my Python installation (I even made a new Anaconda environment to test), but it seems like it messes with Python somehow. Uninstalling odrive fixes this issue completely. – Filip S. Oct 19 '17 at 08:09
  • For anyone curious enough this problem can be reproduced with [`win32trace`](http://ftp.ntua.gr/mirror/python/windows/win32/#win32trace) module. Or more straight approach - just add line `import win32traceutil` and you will see the same message (hello odrive developers!), and your out and err streams will be redirected. However, those streams are closable, but unfortunately there's no automatic option (afaik) to revert to originals, only a manual one. So weak solution is wrap dialog function to another one, which reverts streams to original state on returning. – CommonSense Oct 19 '17 at 10:04
  • Also, the code of that module can be found [here](https://github.com/SublimeText/Pywin32/blob/master/lib/x32/win32/lib/win32traceutil.py). It's clear that something executes `SetupForPrint()` on import. – CommonSense Oct 19 '17 at 10:30
  • Thanks for the explanation. I don't understand how installing odrive does this to my Python installation though. Any idea? I tried looking at my PATH variable before uninstalling, but I couldn't find anything related to odrive. – Filip S. Oct 19 '17 at 11:07

1 Answers1

0

This issue is related to the file syncing service odrive. Uninstalling it fixes the problem, and restores the wanted behaviour.

I figured it out thanks to this comment on a similar thread.

I will try to contact the odrive developers to see if they are aware of the problem, and if there's a fix.

EDIT: I have created a bug report at the odrive forums, and the developers are looking into it: https://forum.odrive.com/t/odrive-explorer-extensions-messes-with-python-tkfiledialog-windows-10/3092

Filip S.
  • 1,514
  • 3
  • 19
  • 40