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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Alexander Pavolotsky's avatar
1
Alexander Pavolotsky
asked 7 years ago
Wingware Support's avatar
4.3k
Wingware Support
updated 5 years ago

Comments

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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Mark Jones's avatar
83
Mark Jones
answered 7 years ago
Wingware Admin's avatar
255
Wingware Admin
updated 6 years ago
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 (7 years ago)
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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Wingware Support's avatar
4.3k
Wingware Support
answered 6 years ago
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 (6 years ago)
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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)