popen4

Discussion in 'Python' started by billie, Oct 16, 2005.

  1. billie

    billie Guest

    Hi all. I'm trying to execute system commands and capture the output by
    using popen4:

    stdout example:
    >>>exec_cmd = popen2.popen4("echo hello!")
    >>>output = exec_cmd[0].read()

    hello

    stderr example:
    >>>exec_cmd = popen2.popen4("echobv hello!")
    >>>output = exec_cmd[0].read()

    Unrecognized command

    The problem occurs when I try to execute interactive commands like ftp,
    python intepreter etc...
    In this case the program crashes without even giving an error.
    Suggestions?

    Regards
     
    billie, Oct 16, 2005
    #1
    1. Advertising

  2. >>>>> "billie" <> (b) wrote:

    >b> Hi all. I'm trying to execute system commands and capture the output by
    >b> using popen4:


    >b> stdout example:
    >>>>> exec_cmd = popen2.popen4("echo hello!")
    >>>>> output = exec_cmd[0].read()

    >b> hello


    >b> stderr example:
    >>>>> exec_cmd = popen2.popen4("echobv hello!")
    >>>>> output = exec_cmd[0].read()

    >b> Unrecognized command


    >b> The problem occurs when I try to execute interactive commands like ftp,
    >b> python intepreter etc...
    >b> In this case the program crashes without even giving an error.


    Crashes?

    >b> Suggestions?


    I think you need something like pyexpect for this.
    --
    Piet van Oostrum <>
    URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
    Private email:
     
    Piet van Oostrum, Oct 17, 2005
    #2
    1. Advertising

  3. billie

    billie Guest

    Piet van Oostrum wrote:
    > I think you need something like pyexpect for this.


    PyExpect seems to be no more mantained.
     
    billie, Oct 18, 2005
    #3
  4. Ganesan Rajagopal, Oct 18, 2005
    #4
  5. Ralf Muschall, Oct 19, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick L. Nolan
    Replies:
    0
    Views:
    351
    Patrick L. Nolan
    Dec 18, 2003
  2. Patrick L. Nolan

    Popen4 -> null lines on Windows

    Patrick L. Nolan, Dec 30, 2003, in forum: Python
    Replies:
    2
    Views:
    307
    Patrick L. Nolan
    Dec 30, 2003
  3. Rasmusson, Lars
    Replies:
    1
    Views:
    767
    popov
    Apr 30, 2004
  4. Roman Yakovenko
    Replies:
    0
    Views:
    1,626
    Roman Yakovenko
    Sep 7, 2004
  5. Jeff Epler
    Replies:
    0
    Views:
    413
    Jeff Epler
    Sep 8, 2004
Loading...

Share This Page