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

SourceForge.net noreply at sourceforge.net
Sun Dec 5 21:05:58 CET 2004


Patches item #1071755, was opened at 2004-11-23 15:35
Message generated for change (Comment added) made by astrand
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: Closed
>Resolution: Fixed
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?
>>> 


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

>Comment By: Peter Åstrand (astrand)
Date: 2004-12-05 21:05

Message:
Logged In: YES 
user_id=344921

Now applied to 2.4-branch:

subprocess.py: 1.8.2.2
test_subprocess.py: 1.15.2.1


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

Comment By: Peter Åstrand (astrand)
Date: 2004-12-01 15:03

Message:
Logged In: YES 
user_id=344921

Should be applied to the 2.4 branch as well. 

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

Comment By: Peter Åstrand (astrand)
Date: 2004-11-30 22:55

Message:
Logged In: YES 
user_id=344921

I've applied the patch (slightly modified) on the CVS trunk:
subprocess.py 1.10
test_subprocess.py 1.16

I've not committed the patch to the 2.4 branch, however. 

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

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