I'm new to Python programming and in the process of learning the sub process
module.
I went through the python documentation
http://docs.python.org/library/subprocess.html and I have the following
queries
1. The class definition as per the documentation is:
*class *subprocess.Popen(*args*, *bufsize=0*, *executable=None*, *stdin=None
*, *stdout=None*, *stderr=None*, *preexec_fn=None*, *close_fds=False*, *
shell=False*, *cwd=None*, *env=None*, *universal_newlines=False*, *
startupinfo=None*, *creationflags=0*)
*args* should be a string, or a sequence of program arguments.
so I assume that args can be a string or a list with first item of the list
being the program to execute.
so on the python IDLE, I executed this command,
subprocess.Popen('cmd.exe')
when I give this as a list, as below it throwed this error.
subprocess.Popen(['cmd.exe', 'dir'])
File "<pyshell#29>", line 1, in <module>
subprocess.Popen(['cmd.exe' 'dir'])
File "C:\Python26\lib\subprocess.py", line 623, in __init__
errread, errwrite)
File "C:\Python26\lib\subprocess.py", line 833, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
>>>
I would assume that a list is accepted as part of the args and first being
the program (cmd.exe) and the rest being the arguments... please correct me
If i misunderstood.
Thanks,
--
Vijay Swaminathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110513/311794be/attachment.html>