From: DOUTCH GARETH-G. <Gar...@mo...> - 2007-02-19 16:54:40
|
Sure, Bug will be submitted shortly... -----Original Message----- From: la...@gm... [mailto:la...@gm...] On Behalf Of Pekka Laukkanen Sent: 19 February 2007 16:51 To: DOUTCH GARETH-GDO003 Cc: jyt...@li... Subject: Re: [Jython-users] os.system and path names with spaces Hi, I tested this on 2.2b1 and couldn't get spaces working in the path but following worked. Unfortunately that is not likely to be a generic solution because the short name generated for non-8dot3 names may, IIUC, be different in different systems. os.system('c:\\PROGRA~1\\MOZILL~1\\firefox.exe www.jython.org') I'm pretty sure that you should never get a java.lang.IllegalArgumentException with os.system. Could you submit this into http://jython.org/bugs? Cheers, .peke 2007/2/19, DOUTCH GARETH-GDO003 <Gar...@mo...>: > Thanks Phil, > I tried your suggestion but still got the same error. (Did it work ok=20 > for you? It works for me in CPython). > This is the full error trace in case anybody might be able to point=20 > out what is going wrong. > (I am running Jython 2.2a1 on java1.6.0 btw). > > >>> 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=20 > 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: > 17 > 4) > 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. > ja > va: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 > > > Gareth > > -----Original Message----- > From: Philipp Walther [mailto:pwa...@pr...] > Sent: 19 February 2007 16:03 > To: DOUTCH GARETH-GDO003; jyt...@li... > Subject: RE: [Jython-users] os.system and path names with spaces > > Gareth, > > os.system('"C:/Program Files/Mozilla Firefox/firefox.exe" > www.google.com') > > should do the trick. > > Notice the forward slashes and the ' and ". > > Cheers > Phil > > > -----Original Message----- > > From: jyt...@li... > > [mailto:jyt...@li...] On Behalf Of=20 > > DOUTCH GARETH-GDO003 > > Sent: Monday, February 19, 2007 3:47 PM > > To: jyt...@li... > > Subject: [Jython-users] os.system and path names with spaces > > > > Hi there, > > > > I am trying to execute a browser with an url parameter passed in.=20 > > For an example > > > > os.system("firefox.exe www.jython.org") > > > > is an ideal kind of format, but it requires the user to add=20 > > C:\Program > > > Files\Mozilla Firefox\ to their system path first. > > > > This I cannot assume, so am letting the user specify the browser of=20 > > choice (and full path to it) in a config file. > > Therefore when the browser path os read, my script generates a=20 > > "browse > > > to this url" command in the following style C:\Program Files\Mozilla > > Firefox\firefox.exe www.jython.org <http://www.jython.org/> using=20 > > os.system. > > > > os.system("C:\Program Files\Mozilla Firefox\firefox.exe > > www.jython.org") however results in a "windows cannot find=20 > > C:\program ... " error. > > > > This format: > > "C:\Program Files\Mozilla Firefox\firefox.exe" > > <http://www.jython.> www.jython. <http://www.jython.org> org works=20 > > nicely from the windows run dialog, but doing: > > os.system('"C:\Program Files\Mozilla Firefox\firefox.exe" > > <http://www.jython./> www.jython.org' > > <http://www.jython.org'> ) gives me a=20 > > java.lang.IllegalArgumentException > > > > Can anyone give me a clue? > > > > Gareth > > > > _______________________________________________________ > > > > Gareth Doutch > > System Test Engineer > > Motorola point to point fixed wireless solutions group > > > > gar...@mo... <mailto:gar...@mo...> > > > > +44 1364 655 581 tel > > +44 1364 654625 fax > > > > Unit A1 Linhay Business Park, > > Eastern Road, > > Ashburton, > > Devon, TQ13 7UP > > > > www.motorola.com/ptp > > _______________________________________________________ > > > > > > > > ---------------------------------------------------------------------- > --- Take Surveys. Earn Cash. Influence the Future of IT Join=20 > SourceForge.net's Techsay panel and you'll get the chance to share=20 > your opinions on IT & business topics through brief surveys-and earn=20 > cash=20 > = http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEV > DEV _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |