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
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
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
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
[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]
>>
[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]
>>
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
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.
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
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
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
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
12 matches
Mail list logo