>>> p1 = Popen("alias", stdout=PIPE, shell=True)
>>>
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
See PyCon Talks from Atlanta 2010 http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/
>>> from subprocess import *
>>> p1 = Popen("bash -i -c alias", stdout=PIPE, shell=True)
>>> p1.stdout.read()
"alias ls='ls --color=auto'\n"
> For shell=True I believe you should provide the command as a single
> string, not a list of arguments.
Using shell=True with an argument list is valid.
On Unix, it's seldom what you want: it will invoke /bin/sh to execute the
first argument with $1, $2, ... set from the remaining arguments.
On Windows, a list is converted to a string in the same manner regardless
of the value of the "shell" argument. Specifying shell=True causes the
command string to be executed via "cmd /c ...". This allows the "program"
to be a script, whereas shell=False requires the program to be a binary
executable.