Re: How to get output of command called by os.system()?

2009-10-31 Thread Rominsky
On Oct 30, 11:09 pm, Peng Yu wrote: > I need to integrate shell program with python. I'm wondering if there > is a way get the output of the shell program called by os.system(). > Thank you! popen should do what your after. There are several modules that have a popen method including os and subp

Re: How to get output of command called by os.system()?

2009-10-30 Thread Chris Rebert
On Fri, Oct 30, 2009 at 11:09 PM, Peng Yu wrote: > I need to integrate shell program with python. I'm wondering if there > is a way get the output of the shell program called by os.system(). You'd probably do better to use the `subprocess` module instead: http://docs.python.org/library/subprocess

How to get output of command called by os.system()?

2009-10-30 Thread Peng Yu
I need to integrate shell program with python. I'm wondering if there is a way get the output of the shell program called by os.system(). Thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get output.

2007-08-10 Thread indu_shreenath
On Aug 10, 12:02 am, Larry Bates <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I corrected a typ below. > > > On Aug 9, 12:50 pm, [EMAIL PROTECTED] wrote: > >> Hey, > > >> I did write the following: > >> but it does not work. > > >> import subprocess as sp > >> try: > >> p = sp.Pope

Re: how to get output.

2007-08-09 Thread Larry Bates
[EMAIL PROTECTED] wrote: > I corrected a typ below. > > On Aug 9, 12:50 pm, [EMAIL PROTECTED] wrote: >> Hey, >> >> I did write the following: >> but it does not work. >> >> import subprocess as sp >> try: >> p = sp.Popen("DIR . /AD /B", stdout=sp.PIPE) >> result = p.communicate()[0] >>

Re: how to get output.

2007-08-09 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I corrected a typ below. > > On Aug 9, 12:50 pm, [EMAIL PROTECTED] wrote: >> Hey, >> >> I did write the following: >> but it does not work. >> >> import subprocess as sp >> try: >> p = sp.Popen("DIR . /AD /B", stdout=sp.PIPE) >> result = p.communicate()[0] >>

Re: how to get output.

2007-08-09 Thread indu_shreenath
I corrected a typ below. On Aug 9, 12:50 pm, [EMAIL PROTECTED] wrote: > Hey, > > I did write the following: > but it does not work. > > import subprocess as sp > try: > p = sp.Popen("DIR . /AD /B", stdout=sp.PIPE) > result = p.communicate()[0] > print result > except: > print "er

Re: how to get output.

2007-08-09 Thread indu_shreenath
Hey, I did write the following: but it does not work. import subprocess as sp try: = sp.Popen("DIR . /AD /B", stdout=sp.PIPE) result = p.communicate()[0] print result except: print "error" This throws error. DIR . /AD /B will list out only directories in the current directory.

Re: how to get output.

2007-08-09 Thread Indu Shreenath
Hey, I did write the following: but it does not work. import subprocess as sp try: = sp.Popen("DIR . /AD /B", stdout=sp.PIPE) result = p.communicate()[0] print result except: print "error" This throws error. DIR . /AD /B will list out only

Re: how to get output.

2007-08-09 Thread Indu Shreenath
Hey, I did write the following, but it does not work. import subprocess as sp try: = sp.Popen("DIR . /AD /B", stdout=sp.PIPE) result = p.communicate()[0] print result except: print "error" This throws error. DIR . /AD /B will list out only dir

Re: how to get output.

2007-08-08 Thread Diez B. Roggisch
indu_shreenath schrieb: > Hey, > I want to get the output of "DIR /AD /B" command to a varriable using > python. How can I do this? Using the subprocess-module. However, I'm not sure what DIR /AD /B does - but there are many functions in module os that might deliver what you want without invok

how to get output.

2007-08-08 Thread indu_shreenath
Hey, I want to get the output of "DIR /AD /B" command to a varriable using python. How can I do this? Thanks, Indu -- http://mail.python.org/mailman/listinfo/python-list