Revision history [back]
Another approach to this is to change sys.stdout and/or sys.stderr in your code to route output to a file. Something like:
import sys
f = open('output.txt', 'w')
old = sys.stdout
sys.stdout = f
...
sys.stdout = old
f.close()
You can of course do this conditionally, possibly only when 'WINGDB_ACTIVE' in os.environ is true, which is only the case when Wing's debugger is active.