FAQ
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.

Search Discussions

  • Sean DiZazzo at Dec 23, 2009 at 10:22 pm

    On Dec 23, 1:57?pm, tekion wrote:
    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
  • Tekion at Dec 24, 2009 at 1:34 pm

    On Dec 23, 5:22?pm, Sean DiZazzo wrote:
    On Dec 23, 1:57?pm, tekion wrote:


    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
    Sean, popen5 is old name for subprocess.
  • Sean DiZazzo at Dec 24, 2009 at 10:02 pm

    On Dec 24, 5:34?am, tekion wrote:
    On Dec 23, 5:22?pm, Sean DiZazzo wrote:


    On Dec 23, 1:57?pm, tekion wrote:

    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
    Sean, popen5 is old name for subprocess.
    Right. Thats why I thought it would help. You _can_ use the
    subprocess module on 2.2.
  • Boris Arloff at Dec 24, 2009 at 4:00 pm

    On Dec 23, 5:22 pm, Sean DiZazzo wrote:
    On Dec 23, 1:57 pm, tekion wrote:


    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
    Sean, popen5 is old name for subprocess.
    ?
    If using a linux platform then look into setting up pipes.? This will give you a communications channel and you can interact with your processes.? I have used this method many times.
    ?



    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/python-list/attachments/20091224/4884adcb/attachment.htm>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedDec 23, '09 at 9:57p
activeDec 24, '09 at 10:02p
posts5
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase