First time here? Check out the FAQ!
0

sys.stdin in Wing IDE problem

Hi.Trying to test simple python-program using stdin object.

import sys

w = []
for s in sys.stdin:
    w.append(s)

print(w)

To stop inputing I send EOF with right-button mouse click. But program terminates and nothing print out.This situation is in Wing IDE 101 under MacOS and Windows.

So, I can't run and test any program that uses stdin.

How can I solve this problem?

Thanx

Alexander Pavolotsky's avatar
1
Alexander Pavolotsky
asked 2018-02-22 03:59:00 -0600
Wingware Support's avatar
4k
Wingware Support
updated 2020-01-22 19:53:11 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

0

That program doesn't work outside of wing either.

If you are writing test code, try putting your inputs into a file and reading from the file.  Then you can use UnitTest instead of typing the same inputs over and over

But the problem with the above program is not wing.

Mark Jones's avatar
83
Mark Jones
answered 2018-02-22 09:15:00 -0600
Wingware Admin's avatar
231
Wingware Admin
updated 2019-03-07 09:01:42 -0600
edit flag offensive 0 remove flag delete link

Comments

It's strange, but this program works good.

Here is a screenshot.https://www.screencast.com/t/12Tq26cTHghj

In bash I can stop inputting sending Ctrl+D.And this is from Wing https://www.screencast.com/t/JNUmFMEnHs 

And here is video from PyCharm https://screencast.com/t/f3rHRZb3PQ

Alexander Pavolotsky's avatar Alexander Pavolotsky (2018-02-22 10:06:00 -0600) edit
add a comment see more comments
0

The program does work for me outside of Wing and I see that it's not working in Wing in either Python Shell or when debugged. The reason for this is apparently that sending EOF doesn't seem to be working. We'll look into what is causing that.

A work-around is to go into the Options menu in the Debug I/O tool and select Configure External Console. Then check on Use External Console. You'll get a separate console window when you debug and pressing Ctrl-D there to send EOF does work and it prints the output and exits.

Thanks for reporting this and sorry for the slow response. We just moved the Q&A forum to another provider and I think we didn't get notice of your question because it hasn't been fully configured yet.

Wingware Support's avatar
4k
Wingware Support
answered 2019-03-13 08:44:24 -0600
edit flag offensive 0 remove flag delete link

Comments

This will be fixed in the Debug I/O, Python Shell, and Debug Probe tools (so the Send EOF item in right-click menu works) in Wing 6.1.6+ and 7rc1+.

Wingware Support's avatar Wingware Support (2019-03-14 09:17:08 -0600) 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