On 20/02/12 21:17, Do Nguyen (donguye) wrote:

command1 = "plink -ssh -pw myPassword myUserName@myServerIP"
p1 = subprocess.Popen(command1)
p2 = subprocess.Popen('ls')

I could verify that command1 was executed successfully, ie. the ssh to
myServer worked, but command2 was treated locally in the Windows

Yes, because you created a new subprocess.Popen object.
If you want to communicate with ssh in the first subprocess you need to send commands to stdin on p1. There are lots of examples how to read/write to stdin/out in the subprocess documentation. (I'm assuming that plink stays open, I've never used it so don't know)

HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to