[wingide-users] redirecting stdin from a file in the debugger?

Wingware Support support at wingware.com
Sat Mar 12 19:01:57 MST 2011

On 3/12/11 6:23 PM, Nelson Minar wrote:
> I'm debugging some scripts which should take large inputs from stdin.
>   $ myScript < bigfile.txt > output.txt
> Is there a way within WingIDE to run the script in debug mode with 
> stdin redirected from a file? I can use stdin by typing in the Debug 
> I/O tab, but I'm trying to input a megabyte-long file on stdin.
> PS: Loving WingIDE 4.0, lots of nice improvements.

If you don't need to do any stdin via the Debug I/O tool I think you can 
just replace sys.stdin w/ a file something like this:

sys.stdin = open('myfile', 'r')

If you want to do this only when Wing's debugger is active then:

import os
if 'WINGDB_ACTIVE' in os.environ:
     sys.std = open('myfile', 'r')

(or something similar)

Please let me know if this does not help.



Stephan Deibel
Wingware | Python IDE
Advancing Software Development


More information about the wingide-users mailing list