sys.stdin in Wing IDE problem


162
views
0
3 months ago by
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
Community: Wing Python IDE

1 Answer


2
3 months ago by
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.
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
written 3 months ago by Alexander Pavolotsky  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »