Re: without shell
- From: Donn Cave <donn@xxxxxxxxxxxxxxxx>
- Date: Fri, 10 Jun 2005 10:13:56 -0700
In article <11aj9d3fga9or8b@xxxxxxxxxxxxxxxxxx>,
Grant Edwards <grante@xxxxxxxx> wrote:
> On 2005-06-10, Mage <mage@xxxxxxx> wrote:
>
> >>py> file_list = os.popen("ls").read()
> >>
> >>Stores the output of ls into file_list.
> >>
> > These commands invoke shell indeed.
>
> Under Unix, popen will not invoke a shell if it's passed a
> sequence rather than a single string.
I suspect you're thinking of the popen2 functions.
On UNIX, os.popen is posix.popen, is a simple wrapper
around the C library popen. It always invokes the
shell.
The no-shell alternatives are spawnv (instead of
system) and the popen2 family (given a sequence
of strings.)
Donn Cave, donn@xxxxxxxxxxxxxxxx
.
- Follow-Ups:
- Re: without shell
- From: David M. Cooke
- Re: without shell
- From: Grant Edwards
- Re: without shell
- References:
- Re: without shell
- From: Steven D'Aprano
- Re: without shell
- From: Mage
- Re: without shell
- From: Grant Edwards
- Re: without shell
- Prev by Date: RE: how to operate the excel by python?
- Next by Date: try: except: ValueError
- Previous by thread: Re: without shell
- Next by thread: Re: without shell
- Index(es):
Relevant Pages
|
Loading