Tyler Wall
Tyler Wall

Reputation: 3788

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 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()

Upvotes: 4

Views: 1206

Answers (1)

jterrace
jterrace

Reputation: 67063

If you look at the Common tab of the run configuration for PyDev:

enter image description here

You can set an output file by filling in the File box. This will redirect standard output to the file. The Allocate console checkbox enables standard input being in the console when running the program. Unfortunately, there is no way to specify a standard input file.

Upvotes: 6

Related Questions