[Python-bugs-list] [ python-Bugs-512433 ] Quote handling in os.system & os.popen
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 03 Feb 2002 09:36:18 -0800
Bugs item #512433, was opened at 2002-02-03 09:36
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=512433&group_id=5470
Category: Windows
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Jimmy Retzlaff (jretz)
Assigned to: Tim Peters (tim_one)
Summary: Quote handling in os.system & os.popen
Initial Comment:
On Python 2.2 under Windows XP:
os.system('"notepad" "test.py"')
does not work as expected. It appears that os.system
attempts to run:
notepad" "test.py
A workaround is to use:
os.system('""notepad" "test.py""')
Both of the following work as expected:
os.system('notepad "test.py"')
os.system('"notepad" test.py')
os.popen exhibits the same behaviour. In naive
testing, the following hack seems to make things
better:
os_system = os.system
os.system = lambda command: os_system('"%s"' %
command)
This may suggest a potential fix in the C code - or
it may simply offend the sensibilities of those more
knowledgeable than me. :)
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=512433&group_id=5470