Bugs item #1634343, was opened at 2007-01-12 21:40
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1634343&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Patrick Mézard (pmezard)
Assigned to: Nobody/Anonymous (nobody)
Summary: subprocess swallows empty arguments under win32

Initial Comment:
Hello,
empty arguments are not quoted by subprocess.list2cmdline. Therefore nothing is 
concatenated with other arguments. To reproduce it:

test-empty.py
"""
import sys
print sys.argv
"""

then:
"""
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> p = subprocess.Popen(['python', 'test-empty.py', ''], 
>>> stdout=subprocess.PIPE)
>>> p.communicate()
("['test-empty.py']\r\n", None)
"""

To solve it:
"""
--- a\subprocess.py     2007-01-12 21:38:57.734375000 +0100
+++ b\subprocess.py     2007-01-12 21:34:08.406250000 +0100
@@ -499,7 +499,7 @@
         if result:
             result.append(' ')

-        needquote = (" " in arg) or ("\t" in arg)
+        needquote = (" " in arg) or ("\t" in arg) or not arg
         if needquote:
             result.append('"')
"""

Regard,
Patrick Mézard


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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1634343&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to