Piet van Oostrum piet at cs.uu.nl
Mon Oct 17 10:12:44 CEST 2005

>>>>> "billie" <mlist at fastwebnet.it> (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.


>b> Suggestions?

I think you need something like pyexpect for this.
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org

More information about the Python-list mailing list