subprocess module usage

Earl Lapus earl.lapus at gmail.com
Sun Aug 31 23:28:45 EDT 2014


Hi,

I made simple test program using the subprocess module (see attached:
exec_cmd.py). I ran it passing variations of 'ls' command options.

I encounter exceptions every time I use '-l' options. Example runs
where exception occurs:
# ./exec_cmd.py ls -al
# ./exec_cmd.py ls -l

However, if I pass 'ls' and arguments as one argument, like so:
#./exec_cmd.py 'ls -al'
exception does not occur.

I logged output (see ls_test.out).

So, what could be causing this behavior? Is this expected or is there
something wrong with how I'm using the subprocess module?

Cheers,
Earl

-- 
There are seven words in this sentence.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: exec_cmd.py
Type: application/octet-stream
Size: 484 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20140901/c49e920e/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ls-test.out
Type: application/octet-stream
Size: 1080 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20140901/c49e920e/attachment-0001.obj>


More information about the Python-list mailing list