First time here? Check out the FAQ!

Problem with stdin in python script (macOS)


I have problem with this script in WingIDE: use this file: as "Run arguments" in "Launch configurations" (< usa.txt).


run this file, but nothing happens.

If I run this file in Geany - it works.It works in Terminal too (python < usa.txt)

Is it my mistake or bug in WingIDE?


andrewd76's avatar
asked 2017-08-27 05:46:00 -0500
Wingware Support's avatar
Wingware Support
updated 2019-03-13 10:15:30 -0500
edit flag offensive 0 remove flag close merge delete


add a comment see more comments

1 Answer


Wing does not interpret the < operator like the bash command line so it's not going to send the contents of usa.txt to the code when you set the arguments to this.  The only work-arounds I can think of are either to use wingdbstub to initiate debug so you can type a command line with < outside of Wing (see for details) or modify your code to start by reading the file and redirect stdio.  It would be something like this untested code:

import sys
from StringIO import StringIO  # In Python 3 it's from io import StringIO instead
f = open('usa.txt')
txt =
sys.stdin = StringIO(txt)
Wingware Support's avatar
Wingware Support
answered 2017-08-28 10:13:00 -0500
Wingware Admin's avatar
Wingware Admin
updated 2019-03-07 07:23:16 -0500
edit flag offensive 0 remove flag delete link


Thank you for support! I've initiate debug outside of Wing and received an error: 

"Debugger: Debug process paused; pid=1930; Listening on TCP/IP port 50005
Allowed hosts: [0 modules loaded]
General: Document Open Failed::Failed to open document '/Applications/'"

There is no such a file in this directory.

andrewd76's avatar andrewd76 (2017-08-28 15:11:00 -0500) edit

Sorry, appears we did not get notice of this comment as we usually do.  I'd need more information to diagnose this.  It's trying to stop on an exception in the debugger internals, but I am not sure why.  It should never do that.  You can get a log from the debug side by setting kLogFile in and then we can interpret that if you email it to us.  Although I realize you may have moved on to other things by now, since this reply is 5 weeks late.  We'll look into what is happening to the email notices from this forum (they mostly work, but I'm finding some missed items).

Wingware Support's avatar Wingware Support (2017-10-03 12:40:00 -0500) edit

Well, I've just copy this file from Wing (win edition). It's OK now. Thanks for support!

andrewd76's avatar andrewd76 (2017-10-03 12:54:00 -0500) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer