Nathan McBride wrote:
> That's a great tip I'll have to save than.
Nathan,
I'm not sure why you sent this three times, but we've gotten it, if
you're worried about it.
Thanks,
-Luke
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/l
That's a great tip I'll have to save than.
-Original Message-
From: Martin Walsh <[EMAIL PROTECTED]>
Sent: Monday, March 17, 2008 9:38 AM
To: Nathan McBride <[EMAIL PROTECTED]>
Cc: tutor@python.org
Subject: Re: [Tutor] how to get response from os.system()
Hi N
That's a great tip I'll have to save than.
-Original Message-
From: Martin Walsh <[EMAIL PROTECTED]>
Sent: Monday, March 17, 2008 9:38 AM
To: Nathan McBride <[EMAIL PROTECTED]>
Cc: tutor@python.org
Subject: Re: [Tutor] how to get response from os.system()
Hi N
That's a great tip I'll have to save than.
-Original Message-
From: Martin Walsh <[EMAIL PROTECTED]>
Sent: Monday, March 17, 2008 9:38 AM
To: Nathan McBride <[EMAIL PROTECTED]>
Cc: tutor@python.org
Subject: Re: [Tutor] how to get response from os.system()
Hi N
That's a great tip I'll have to save than.
-Original Message-
From: Martin Walsh <[EMAIL PROTECTED]>
Sent: Monday, March 17, 2008 9:38 AM
To: Nathan McBride <[EMAIL PROTECTED]>
Cc: tutor@python.org
Subject: Re: [Tutor] how to get response from os.system()
Hi N
;')
child.expect(pexpect.EOF)
"""
HTH,
Marty
> -Original Message-
> From: Jeff Younker <[EMAIL PROTECTED]>
> Sent: Sunday, March 16, 2008 6:59 PM
> To: Nathan McBride <[EMAIL PROTECTED]>
> Cc: tutor@python.org
> Subject: Re: [Tutor] how to get r
e-
> From: Jeff Younker <[EMAIL PROTECTED]>
> Sent: Sunday, March 16, 2008 6:59 PM
> To: Nathan McBride <[EMAIL PROTECTED]>
> Cc: tutor@python.org
> Subject: Re: [Tutor] how to get response from os.system()
>
>
>
>
> > Would you mind perhaps show an
hon.org
Subject: Re: [Tutor] how to get response from os.system()
> Would you mind perhaps show an example running an interactive
> command like su and show how to send input to the commands waiting
> propmts?
If you're doing that then you *really* want to be using the
> Would you mind perhaps show an example running an interactive
> command like su and show how to send input to the commands waiting
> propmts?
If you're doing that then you *really* want to be using the pexpect
module.
cmd = pexpect.spawn('su - SOMEINTERACTIVECOMMAND')
cmd.expect('# ') #
Nathan McBride wrote:
> Would you mind perhaps show an example running an interactive command like su
> and show how to send input to the commands waiting propmts?
Using the subprocess module, open a command and save the stdin and
stdout pipes as variables. Then write to the stdin to send data t
linuxian iandsd wrote:
> use os.popen("your cmd here")
This is deprecated in 2.5+, you're supposed to use subprocess module now.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Would you mind perhaps show an example running an interactive command like su
and show how to send input to the commands waiting propmts?
-Original Message-
From: linuxian iandsd <[EMAIL PROTECTED]>
Sent: Sunday, March 16, 2008 3:17 PM
To: tutor@python.org
Subject: Re: [Tutor] how
Why don't you just use 'commands.getoutput'?
-Original Message-
From: linuxian iandsd <[EMAIL PROTECTED]>
Sent: Sunday, March 16, 2008 3:12 PM
To: tutor@python.org
Subject: Re: [Tutor] how to get response from os.system()
use os.popen("your cmd here")
i guess that was too short tutorial well, here is an example from a live
session on the interpreter.
[EMAIL PROTECTED] ~]# python
Python 2.5.1 (r251:54863, Nov 23 2007, 16:16:53)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information
use os.popen("your cmd here")
On Sun, Mar 16, 2008 at 8:06 PM, Luke Paireepinart <[EMAIL PROTECTED]>
wrote:
> shawn bright wrote:
> > Lo there all,
> >
> > I am needing to get a response back from a system command.
> > i can do this:
> >
> > os.system('mailq | wc -l")
> >
> > if i do this in
shawn bright wrote:
> Lo there all,
>
> I am needing to get a response back from a system command.
> i can do this:
>
> os.system('mailq | wc -l")
>
> if i do this in the terminal mailq | wc -l , it will spit out a number.
> How do i get that number as a python variable ?
You need to use t
Lo there all,
I am needing to get a response back from a system command.
i can do this:
os.system('mailq | wc -l")
if i do this in the terminal mailq | wc -l , it will spit out a number.
How do i get that number as a python variable ?
OK, thanks.
shawn
17 matches
Mail list logo