[Patches] [ python-Patches-1071755 ] raise error for common mistake with subprocess

SourceForge.net noreply at sourceforge.net
Tue Nov 23 15:35:03 CET 2004


Patches item #1071755, was opened at 2004-11-23 14:35
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1071755&group_id=5470

Category: Library (Lib)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Nick Craig-Wood (ncw)
Assigned to: Nobody/Anonymous (nobody)
Summary: raise error for common mistake with subprocess

Initial Comment:
subprocess has a very easy to mistake error in it -
forgetting to pass the command as a list.  Eg

>>> import subprocess
>>> subprocess.call("ls")
BaseHTTPServer.py      dummy_threading.py 
pickletools.py   socket.py
Bastion.py             email               pipes.py   
     sre.py
[...]
dummy_thread.py        pickle.pyc          sndhdr.py  
     zipfile.py
0
>>> subprocess.call("ls", "-l")
BaseHTTPServer.py      dummy_threading.py 
pickletools.py   socket.py
Bastion.py             email               pipes.py   
     sre.py
[...]
dummy_thread.py        pickle.pyc          sndhdr.py  
     zipfile.py
0
>>> 

# Note no error, warning or anything, but no "ls -l" either

And with the patch...

>>> subprocess.call("ls", "-l")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "subprocess.py", line 428, in call
    return Popen(*args, **kwargs).wait()
  File "subprocess.py", line 508, in __init__
    raise TypeError("bufsize must be an integer - "
TypeError: bufsize must be an integer - did you forget
to pass your arguments in a list?
>>> 


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1071755&group_id=5470


More information about the Patches mailing list