Python Eclipse Pipe

Question

Like this question, I am new to Python.

I have the following simple program running in Eclipse Juno using PyDev - OSX 10.8.1. I want to pass the stdin stream. If I were doing this on the command line, it would look like this:

python main.py <test_input.txt

How do I add this to my eclipse project settings?


code

 import sys def getArgs(): if sys.stdin.isatty(): for line in sys.stdin: print line def main(): getArgs() if __name__ == "__main__": main() 
+4
source share
1 answer

If you look at the General tab of the launch configuration for PyDev:

enter image description here

You can set the output file by filling in the File field. This will redirect standard output to a file. The Allocate console checkbox allows you to use the standard input on the console when the program starts. Unfortunately, there is no way to specify a standard input file.

+6
source

Source: https://habr.com/ru/post/1432369/


All Articles