subprocess module: execution of standard binaries without shell?

Christian Heimes lists at
Thu Feb 26 05:46:08 EST 2009

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?
> a) pipe = subprocess.Popen("/bin/ls /", stdout=subprocess.PIPE,
> close_fds=True)
> 		==>OSError: [Errno 2] No such file or directory

You have to use a list instead of a string here.

pipe = subprocess.Popen(["/bin/ls", "/"], stdout=subprocess.PIPE)

More information about the Python-list mailing list