Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > popen4

Reply
Thread Tools

popen4

 
 
billie
Guest
Posts: n/a
 
      10-16-2005
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


 
Reply With Quote
 
 
 
 
Piet van Oostrum
Guest
Posts: n/a
 
      10-17-2005
>>>>> "billie" <(E-Mail Removed)> (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 <(E-Mail Removed)>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
billie
Guest
Posts: n/a
 
      10-18-2005

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


PyExpect seems to be no more mantained.


 
Reply With Quote
 
Ganesan Rajagopal
Guest
Posts: n/a
 
      10-18-2005
>>>>> "billie" == billie <(E-Mail Removed)> writes:

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


> PyExpect seems to be no more mantained.


Try pexpect instead. http://pexpect.sourceforce.net/

Ganesan

--
Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA
Web: http://employees.org/~rganesan | http://rganesan.blogspot.com

 
Reply With Quote
 
Ralf Muschall
Guest
Posts: n/a
 
      10-19-2005
Ganesan Rajagopal wrote:

> Try pexpect instead. http://pexpect.sourceforce.net/

^

That's a content-free ad site. You probably mean sourceforGe.

Ralf
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: os.popen4 and popen2.popen4 undocumented behavior Jeff Epler Python 0 09-08-2004 02:22 PM
os.popen4 and popen2.popen4 undocumented behavior Roman Yakovenko Python 0 09-07-2004 04:42 AM
Doing readline in a thread from a popen4('rsync ...') stream blocks when the stream ends. Rasmusson, Lars Python 1 04-30-2004 08:10 AM
Popen4 -> null lines on Windows Patrick L. Nolan Python 2 12-30-2003 05:31 PM
Tkinter+popen4+windows leads to unwanted window Patrick L. Nolan Python 0 12-18-2003 07:15 AM



Advertisments