I have a python program that SSH's into a system, runs a .py script and has to cat a file.
Once it has run the .py script after SSHing into the remote system, I have to manually hit "return" for the cat program to display the contents of the file. This is because the program is stuck at that point.
What I have looks like this:
s = subprocess.Popen(["../../run.py", "cat", "../../file.xml")
If I understand correctly you want to run a python script, wait for it to finish, and then cat a file? If that is correct, you would have to use two subprocess calls. Your line as written is running run.py with arguments cat and ../../file.xml
Why does run.py wait for user input? My first choice would be to change that. With that not being an option, I may go for something like
echo "/n" > python ../../run.py
I am not sure what your plan is behind all of this :) If this is the extent of what you are trying to do, a shell script would be a better choice. Something like this-
ssh user@myserver -c "echo "/n" > python ../../run.py; cat ../../file.xml"
If it is something else, the docs for the subprocess module can explain lots of different ways of entering input into and reading output from a subprocess.