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 a stdin stream. If i were running this in the comand line it would look as follows:
python main.py < test_input.txt
How do I go about adding this to the parameters for my eclipse project?
Code
import sys
def getArgs():
if sys.stdin.isatty():
for line in sys.stdin:
print line
def main():
getArgs()
if __name__ == "__main__":
main()
If you look at the Common tab of the run configuration for PyDev:
You can set an output file by filling in the
Filebox. This will redirect standard output to the file. TheAllocate consolecheckbox enables standard input being in the console when running the program. Unfortunately, there is no way to specify a standard input file.