Issue1664437
Created on 2007-02-20.15:51:33 by garethdoutch, last changed 2009-06-21.21:45:58 by pjenvey.
| Messages | |||
|---|---|---|---|
| msg1501 (view) | Author: GDoutch (garethdoutch) | Date: 2007-02-20.15:51:33 | |
os.system, when calling an application with a space in the path name, causes java.lang.IllegalArgumentException to be thrown.
An example of the command (which works in CPython):
os.system('"C:/Program Files/Mozilla Firefox/firefox.exe" www.jython.org')
I am running Jython 2.2a1 on java1.6.0 and WinXP. The following is a copy of my Exception Trace:
>>> os.system('"C:/Program Files/Mozilla Firefox/firefox.exe" www.jython.org')
Traceback (innermost last):
File "<console>", line 1, in ?
File "C:\jython\Lib\javaos.py", line 228, in system
File "C:\jython\Lib\popen2.py", line 232, in system
File "C:\jython\Lib\popen2.py", line 69, in __init__
File "C:\jython\Lib\javashell.py", line 61, in execute java.lang.IllegalArgumentException
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:174)
at org.python.core.PyMethod.__call__(PyMethod.java:93)
at org.python.core.PyObject.__call__(PyObject.java:607)
at javashell$py.execute$4(C:\jython\Lib\javashell.py:61)
at javashell$py.call_function(C:\jython\Lib\javashell.py)
at org.python.core.PyTableCode.call(PyTableCode.java:213)
at org.python.core.PyTableCode.call(PyTableCode.java:426)
at org.python.core.PyTableCode.call(PyTableCode.java:322)
at org.python.core.PyFunction.__call__(PyFunction.java:193)
at org.python.core.PyMethod.__call__(PyMethod.java:93)
at org.python.core.PyObject.__call__(PyObject.java:594)
at popen2$py.__init__$7(C:\jython\Lib\popen2.py:69)
at popen2$py.call_function(C:\jython\Lib\popen2.py)
at org.python.core.PyTableCode.call(PyTableCode.java:213)
at org.python.core.PyTableCode.call(PyTableCode.java:426)
at org.python.core.PyTableCode.call(PyTableCode.java:322)
at org.python.core.PyFunction.__call__(PyFunction.java:193)
at org.python.core.PyInstance.__init__(PyInstance.java:174)
at org.python.core.PyClass.__call__(PyClass.java:293)
at org.python.core.PyObject.__call__(PyObject.java:621)
at popen2$py.system$21(C:\jython\Lib\popen2.py:232)
at popen2$py.call_function(C:\jython\Lib\popen2.py)
at org.python.core.PyTableCode.call(PyTableCode.java:213)
at org.python.core.PyTableCode.call(PyTableCode.java:426)
at org.python.core.PyFunction.__call__(PyFunction.java:187)
at org.python.core.PyObject._callextra(PyObject.java:725)
at javaos$py.system$40(C:\jython\Lib\javaos.py:228)
at javaos$py.call_function(C:\jython\Lib\javaos.py)
at org.python.core.PyTableCode.call(PyTableCode.java:213)
at org.python.core.PyTableCode.call(PyTableCode.java:426)
at org.python.core.PyFunction.__call__(PyFunction.java:187)
at org.python.core.PyMethod.__call__(PyMethod.java:120)
at org.python.core.PyObject.__call__(PyObject.java:594)
at org.python.pycode._pyx43.f$0(<console>:1)
at org.python.pycode._pyx43.call_function(<console>)
at org.python.core.PyTableCode.call(PyTableCode.java:213)
at org.python.core.PyCode.call(PyCode.java:14)
at org.python.core.Py.runCode(Py.java:1182)
at org.python.core.Py.exec(Py.java:1204)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:148)
at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:88)
at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:69)
at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:44)
at org.python.util.InteractiveConsole.push(InteractiveConsole.java:83)
at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:62)
at org.python.util.jython.main(jython.java:214)
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException
|
|||
| msg1502 (view) | Author: howard kapustein (hsk0) | Date: 2007-02-21.04:09:12 | |
And yet, oddly enough, passing the command as a list of strings works fine GOOD: jython.bat -c "import os ; os.system(['\\Program Files\\WinZip\\WINZIP32.EXE', 'FOO.ZIP'])" BAD: jython.bat -c "import os ; os.system(chr(34) + '\\Program Files\\WinZip\\WINZIP32.EXE' + chr(34) + ' FOO.ZIP')" BTW a print shellCmd statement in javashell.py just before line 61 displays this just before the exception: ['cmd', '/c', '"\\Program Files\\WinZip\\WINZIP32.EXE" FOO.ZIP'] |
|||
| msg1503 (view) | Author: Pekka Klärck (pekka.klarck) | Date: 2007-02-21.13:39:36 | |
More information from jython-users:
Neil Hughes writes:
On 20/02/2007 22:24, Michael March wrote:
> Here's a lame work-around I came up with.. I tested this under 2.2b1
>
> >>> os.system('\"\"c:/program files/mozilla firefox/firefox.exe\"
> www.google.com\"')
Hey, don't knock it...it works :-)
Under 2.1 also. Bravo!
|
|||
| msg4831 (view) | Author: Philip Jenvey (pjenvey) | Date: 2009-06-21.21:45:58 | |
After much pain this is solved in 2.5, which works just as CPython does |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2009-06-21 21:45:58 | pjenvey | set | status: open -> closed resolution: fixed messages: + msg4831 nosy: + pjenvey |
| 2009-03-14 01:15:16 | fwierzbicki | set | nosy: + fwierzbicki |
| 2009-03-14 01:15:04 | fwierzbicki | set | priority: normal -> low versions: + Deferred |
| 2007-02-20 15:51:33 | garethdoutch | create | |
Supported by Python Software Foundation,
Powered by Roundup