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\"')
*** CLB *** Initializing Google Browser Sync...
*** CLB *** Instanciating core objects...
*** CLB *** Registering with XPCOM...
*** CLB *** Adding categories...
*** CLB *** Google Browser Sync initialized succesfully!
0


On 2/19/07, Pekka Laukkanen <peke@iki.fi> wrote:
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 < Gareth.Doutch@motorola.com>:
> Thanks Phil,
> I tried your suggestion but still got the same error. (Did it work ok
> for you? It works for me in CPython).
> This is the full error trace in case anybody might be able to point 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
> 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:pwalther@progress.com]
> Sent: 19 February 2007 16:03
> To: DOUTCH GARETH-GDO003; jython-users@lists.sourceforge.net
> 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: jython-users-bounces@lists.sourceforge.net
> > [mailto: jython-users-bounces@lists.sourceforge.net ] On Behalf Of
> > DOUTCH GARETH-GDO003
> > Sent: Monday, February 19, 2007 3:47 PM
> > To: jython-users@lists.sourceforge.net
> > 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. For
> > an example
> >
> > os.system ("firefox.exe www.jython.org")
> >
> > is an ideal kind of format, but it requires the user to add C:\Program
>
> > Files\Mozilla Firefox\ to their system path first.
> >
> > This I cannot assume, so am letting the user specify the browser of
> > choice (and full path to it) in a config file.
> > Therefore when the browser path os read, my script generates a "browse
>
> > to this url" command in the following style C:\Program Files\Mozilla
> > Firefox\firefox.exe www.jython.org <http://www.jython.org/ >  using
> > os.system.
> >
> > os.system("C:\Program Files\Mozilla Firefox\firefox.exe
> > www.jython.org") however results in a "windows cannot find C:\program
> > ... " error.
> >
> > This format:
> > "C:\Program Files\Mozilla Firefox\firefox.exe"
> > < http://www.jython.> www.jython . <http://www.jython.org> org works
> > 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
> > java.lang.IllegalArgumentException
> >
> > Can anyone give me a clue?
> >
> > Gareth
> >
> > _______________________________________________________
> >
> > Gareth Doutch
> > System Test Engineer
> > Motorola point to point fixed wireless solutions group
> >
> > gareth.doutch@motorola.com <mailto:gareth.doutch@motorola.com>
> >
> > +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 SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Jython-users mailing list
> Jython-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jython-users
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net 's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net