1

I run some python files in Linux through command line and I want the out-put of one file to be the input to another..

Eg. in the command line

python  file1.python file1.txt

display some characters.....

and I want these characters to be used to another command So I want something like

python file2.python   characters_from_previous_output file2.txt

I know that this is wrong but lets say

python file2.python   (python file1.python file1.txt ) file2.txt
  • possible duplicate of [How do you read from stdin in python](http://stackoverflow.com/questions/1450393/how-do-you-read-from-stdin-in-python) – devnull Jan 27 '14 at 05:34
  • I do not feel that they are the same.. – user2617287 Jan 27 '14 at 06:05
  • Why do you need `file1.txt` and `file2.txt` as arguments for these scripts execution? What are they used for? Are you reading from them or writing to them? –  Jan 27 '14 at 09:20

1 Answers1

0
  1. Make file2.python to accept standard input instead of file input
  2. Run python file1.python file1.txt | python file2.python file2.txt
timrau
  • 22,578
  • 4
  • 51
  • 64
  • I get "IOError: [Errno 32] Broken pipe" .. I made a mistake before the first python command is like python file1.py a < b and the second one is like python file2.python previous_output c – user2617287 Jan 27 '14 at 05:48