Re: subprocess module: execution of standard binaries without shell?

2009-02-26 Thread Chris Rebert
On Thu, Feb 26, 2009 at 2:41 AM, Visco Shaun wrote: > hi all > > while getting used to with subprocess module i failed in executuing a) > but succeeded in running b). Can anyone explain me why as i am providing > absolute path? Is this has to do anything with shared library.. which > must be acces

Re: subprocess module: execution of standard binaries without shell?

2009-02-26 Thread Christian Heimes
Visco Shaun schrieb: > hi all > > while getting used to with subprocess module i failed in executuing a) > but succeeded in running b). Can anyone explain me why as i am providing > absolute path? Is this has to do anything with shared library.. which > must be accessed based on system variables?

subprocess module: execution of standard binaries without shell?

2009-02-26 Thread Visco Shaun
hi all while getting used to with subprocess module i failed in executuing a) but succeeded in running b). Can anyone explain me why as i am providing absolute path? Is this has to do anything with shared library.. which must be accessed based on system variables? a) pipe = subprocess.Popen("/bi

Re: Subprocess with and without shell

2007-06-29 Thread James T. Dennis
George Sakkis <[EMAIL PROTECTED]> wrote: > On May 15, 5:30 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: >> George Sakkis <[EMAIL PROTECTED]> wrote: >>> I'm trying to figure out why Popen captures the stderr of a specific >>> command when it runs through the shell but not without it. IOW: >>>

Re: Subprocess with and without shell

2007-05-15 Thread George Sakkis
On May 15, 5:30 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > George Sakkis <[EMAIL PROTECTED]> wrote: > > I'm trying to figure out why Popen captures the stderr of a specific > > command when it runs through the shell but not without it. IOW: > > > cmd = [my_exe, arg1, arg2, ..., argN] > >

Re: Subprocess with and without shell

2007-05-15 Thread Nick Craig-Wood
ython from subprocess import Popen, PIPE cmd = ["./zz.py"] for i in range(2): if i: # this captures both stdout and stderr as expected print "With shell" pipe = Popen(' '.join(cmd), shell=True, stderr=PIPE, stdout=PIPE) else: # this captures on

Subprocess with and without shell

2007-05-14 Thread George Sakkis
I'm trying to figure out why Popen captures the stderr of a specific command when it runs through the shell but not without it. IOW: cmd = [my_exe, arg1, arg2, ..., argN] if 1: # this captures both stdout and stderr as expected pipe = Popen(' '.join(cmd), shell=True, stderr=PIPE, stdout=PIPE)

Re: without shell

2005-06-10 Thread Terry Hancock
On Friday 10 June 2005 05:30 am, Tomasz Rola wrote: > On Sun, 12 Jun 2005, km wrote: > > > hi all, > > > > can any linux command be invoked/ executed without using shell (bash) ? > > what abt security concerns ? > > Ops, I missed the word "command" when reading your mail for the first > time, an

Re: without shell

2005-06-10 Thread Reinhold Birkenfeld
Donn Cave wrote: >> Not according the the docs: >> >> Also, for each of these variants, on Unix, cmd may be a >> sequence, in which case arguments will be passed directly to >> the program without shell intervention (as with os.spawnv()). >> If cmd

Re: without shell

2005-06-10 Thread Grant Edwards
On 2005-06-10, Donn Cave <[EMAIL PROTECTED]> wrote: >> Also, for each of these variants, on Unix, cmd may be a >> sequence, in which case arguments will be passed directly to >> the program without shell intervention (as with os.spawnv()). >> If cmd is a s

Re: without shell

2005-06-10 Thread Donn Cave
, os.popen is posix.popen, is a simple wrapper around > > the C library popen. It always invokes the shell. > > Not according the the docs: > > Also, for each of these variants, on Unix, cmd may be a > sequence, in which case arguments will be passed directly to > the pr

Re: without shell

2005-06-10 Thread David M. Cooke
Donn Cave <[EMAIL PROTECTED]> writes: > In article <[EMAIL PROTECTED]>, > Grant Edwards <[EMAIL PROTECTED]> wrote: > >> On 2005-06-10, Mage <[EMAIL PROTECTED]> wrote: >> >> >>py> file_list = os.popen("ls").read() >> >> >> >>Stores the output of ls into file_list. >> >> >> > These commands invoke

Re: without shell

2005-06-10 Thread Grant Edwards
It always invokes the shell. Not according the the docs: Also, for each of these variants, on Unix, cmd may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If cmd is a string it will be passed to the shell (as with

RE: without shell

2005-06-10 Thread Michael Chermside
KM writes: > can any linux command be invoked/ executed without using shell (bash) ? > what abt security concerns ? Yes. See: http://docs.python.org/lib/module-subprocess.html An exerpt: > On Unix, with shell=False (default): In this case, the Popen class uses > os.execvp() to execute the child

Re: without shell

2005-06-10 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2005-06-10, Mage <[EMAIL PROTECTED]> 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 invo

Re: without shell

2005-06-10 Thread Steven D'Aprano
On Fri, 10 Jun 2005 14:13:05 +, Grant Edwards wrote: > On 2005-06-10, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> On Sun, 12 Jun 2005 23:16:35 +0530, km wrote: >> >>> hi all, >>> >>> can any linux command be invoked/ executed without using shell (bash) ? >> >> py> import os >> py> status =

Re: without shell

2005-06-10 Thread Grant Edwards
On 2005-06-10, Mage <[EMAIL PROTECTED]> 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. -- Grant Edwards

Re: without shell

2005-06-10 Thread Mage
Steven D'Aprano wrote: >On Sun, 12 Jun 2005 23:16:35 +0530, km wrote: > > > >>hi all, >> >>can any linux command be invoked/ executed without using shell (bash) ? >> >> > >py> import os >py> status = os.system("ls") > >Prints the output of ls and stores the exit code into status. > >py> fil

Re: without shell

2005-06-10 Thread Grant Edwards
On 2005-06-10, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sun, 12 Jun 2005 23:16:35 +0530, km wrote: > >> hi all, >> >> can any linux command be invoked/ executed without using shell (bash) ? > > py> import os > py> status = os.system("ls") > > Prints the output of ls and stores the exit cod

Re: without shell

2005-06-10 Thread Grant Edwards
On 2005-06-12, km <[EMAIL PROTECTED]> wrote: > can any linux command be invoked/executed without using shell (bash)? Yes -- for some values of "linux command". You can execute anything that's not a bash internal or a bash script without using bash. > what abt security concerns? What about them

Re: without shell

2005-06-10 Thread Steven D'Aprano
On Sun, 12 Jun 2005 23:16:35 +0530, km wrote: > hi all, > > can any linux command be invoked/ executed without using shell (bash) ? py> import os py> status = os.system("ls") Prints the output of ls and stores the exit code into status. py> file_list = os.popen("ls").read() Stores the output

Re: without shell

2005-06-10 Thread Tomasz Rola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sun, 12 Jun 2005, km wrote: > hi all, > > can any linux command be invoked/ executed without using shell (bash) ? > what abt security concerns ? Ops, I missed the word "command" when reading your mail for the first time, and this changes some p

Re: without shell

2005-06-10 Thread Tomasz Rola
k from the OS, and put inside some replacement of your own. But it all depends on what exactly you are going to achieve... 1. Disabling rootkits/shellcodes. Without shell (i.e. bash/sh), you loose lots of functionality and you don't get as much in exchange. If what you want really is to di

without shell

2005-06-09 Thread km
hi all, can any linux command be invoked/ executed without using shell (bash) ? what abt security concerns ? regards, KM -- http://mail.python.org/mailman/listinfo/python-list