By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,907 Members | 2,031 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,907 IT Pros & Developers. It's quick & easy.

popen4

P: n/a
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
Oct 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
>>>>> "billie" <ml***@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.
Crashes?
b> Suggestions?


I think you need something like pyexpect for this.
--
Piet van Oostrum <pi**@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: pi**@vanoostrum.org
Oct 17 '05 #2

P: n/a

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


PyExpect seems to be no more mantained.
Oct 18 '05 #3

P: n/a
>>>>> "billie" == billie <ml***@fastwebnet.it> 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

Oct 18 '05 #4

P: n/a
Ganesan Rajagopal wrote:
Try pexpect instead. http://pexpect.sourceforce.net/

^

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

Ralf
Oct 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.