Re: [Tutor] how to get response from os.system()

2008-03-17 Thread Luke Paireepinart
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

Re: [Tutor] how to get response from os.system()

2008-03-17 Thread Nathan McBride
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

Re: [Tutor] how to get response from os.system()

2008-03-17 Thread Nathan McBride
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

Re: [Tutor] how to get response from os.system()

2008-03-17 Thread Nathan McBride
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

Re: [Tutor] how to get response from os.system()

2008-03-17 Thread Nathan McBride
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

Re: [Tutor] how to get response from os.system()

2008-03-17 Thread Martin Walsh
;') 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

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread shawn bright
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

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Nathan McBride
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

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Jeff Younker
> 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('# ') #

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Luke Paireepinart
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

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Luke Paireepinart
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

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Nathan McBride
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

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Nathan McBride
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")

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread linuxian iandsd
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

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread linuxian iandsd
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

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Luke Paireepinart
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

[Tutor] how to get response from os.system()

2008-03-16 Thread shawn bright
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