python 2.x and running shell command

T

tekion

All,
some of the servers I have run python 2.2, which is a drag because I
can't use subprocess module. My options that I know of is popen2
module. However, it seems it does not have io blocking
capabilities. So every time run a command I have open and close a
file handle. I have command that requires interactive interaction. I
want to be be able to perform following action:
fout, fin = popen2.open2(cmd) #open up interactive session
fin.write(cmd2);
block (input)
fout.readline()
block output
fin.write(cmd2)
and so on...

is this possible with popen2 or do I have to use pexpect for the job?
Thanks.
 
S

Sean DiZazzo

All,
some of the servers I have run python 2.2, which is a drag because I
can't use subprocess module.  My options that I know of is popen2
module.  However, it seems it does not have io blocking
capabilities.   So every time run a command I have open and close a
file handle.  I have command that requires interactive interaction. I
want to be be able to perform following action:
fout, fin = popen2.open2(cmd) #open up interactive session
fin.write(cmd2);
block (input)
fout.readline()
block output
fin.write(cmd2)
and so on...

is this possible with popen2 or do I have to use pexpect for the job?
Thanks.

I've never done that with subprocess, but maybe this will help:
http://www.lysator.liu.se/~astrand/popen5/

~Sean
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top