Issue1624
Created on 2010-06-29.04:19:37 by SchlauFuchs, last changed 2010-10-23.07:07:42 by otmarhumbel.
Messages | |||
---|---|---|---|
msg5852 (view) | Author: Kai Hackemesser (SchlauFuchs) | Date: 2010-06-29.04:19:36 | |
I called a python script with a command line argument which is a windows path with spaces in it. The usual way to do so is to put it in double quotes. This argument was ending with a backslash. so the last two characters of the quoted argument were '\"'. Using Pydev debugger I could see that in the sys.argv list leading quote was removed, but the trailing one was still there - but the backslash was removed. I assume there was some escaping logic applied to the parameter in the wrong order with the code that unquotes a quoted parameter. |
|||
msg5853 (view) | Author: Oti Humbel (otmarhumbel) | Date: 2010-06-29.06:17:33 | |
Could you please provide the exact command line that you use? Thanks! Oti. |
|||
msg5855 (view) | Author: Kai Hackemesser (SchlauFuchs) | Date: 2010-06-29.08:34:41 | |
I used the robot framework (http://code.google.com/p/robotframework) scripts. There is a jybot.bat file that starts the script "runner.py" with the given parameters. But the symptom is reproducible with a direct call. I'm not at work at the moment, but the command line is looking like this: jython runner.py "C:\workspace\project x\tests\" |
|||
msg5856 (view) | Author: Oti Humbel (otmarhumbel) | Date: 2010-06-29.09:14:22 | |
I used the --print option to see what command really is invoked. jython.bat --print runner.py "c:\Program Files\some\" resulted in: java org.python.util.jython runner.py "c:\Program Files\some\" jython.bat --print runner.py "c:\Program Files\some" resulted in: java org.python.util.jython runner.py "c:\Program Files\some" IMHO this is as expected (i snipped the java arguments). |
|||
msg5857 (view) | Author: Kai Hackemesser (SchlauFuchs) | Date: 2010-06-29.09:19:46 | |
>> jython.bat --print runner.py "c:\Program Files\some\" resulted in: java org.python.util.jython runner.py "c:\Program Files\some\" << This is the case I want to demonstrate. Could you test it by letting a python script show you the content of sys.argv? I found the call is fine but inside of jythons interpreter it gets ugly. (used Pydev in eclipse to debug.) |
|||
msg5858 (view) | Author: Oti Humbel (otmarhumbel) | Date: 2010-06-29.09:26:39 | |
like so: jython.bat -c "import sys; print sys.argv" "c:\Program Files\some\" ['-c', 'c:\\Program Files\\some" '] jython.bat -c "import sys; print sys.argv" "c:\Program Files\some" ['-c', 'c:\\Program Files\\some'] |
|||
msg5859 (view) | Author: Kai Hackemesser (SchlauFuchs) | Date: 2010-06-29.09:38:42 | |
you got it, see your first output - the backslash is lost, the quote is there. |
|||
msg5860 (view) | Author: Oti Humbel (otmarhumbel) | Date: 2010-06-29.09:56:50 | |
ok i thought it is a .bat issue at first place, but it is probably not. i will investigate more - thanks! |
|||
msg6203 (view) | Author: Oti Humbel (otmarhumbel) | Date: 2010-10-23.06:31:37 | |
tested with 2.5.2rc1 - the full string is passed to jython: C:\stuff\jython\jython-2.5.2rc1>jython.bat --print -c "import sys; print sys.argv" "c:\Program Files\some\" "C:\Program Files\Java\jre6\bin\java" -Xmx512m -Xss1152k -Dpython.home="C:\stuff\jython\jython-2.5.2rc1" -Dpython.executable="C:\stuff\jython\jython-2.5.2rc1\jython.bat" -classpath "C:\stuff\jython\jython-2.5.2rc1\jython.jar" org.python.util.jython -c "import sys; print sys.argv" "c:\Program Files\some\" |
|||
msg6204 (view) | Author: Oti Humbel (otmarhumbel) | Date: 2010-10-23.07:07:41 | |
I put some System.out.println() statements right into the jython main program: C:\stuff\jython\jython-7164>jython.bat -c "import sys; print sys.argv" "c:\Program Files\some\" passed args: -c import sys; print sys.argv c:\Program Files\some" parsed arguments: -c c:\Program Files\some" executing import sys; print sys.argv ['-c', 'c:\\Program Files\\some" '] Even if I call java directly, the trailing backslash is replaced by a double quote: C:\stuff\jython\jython-7164>"C:\Program Files\Java\jre6\bin\java" -Xmx512m -Xss1152k -Dpython.home="C:\stuff\jython\jython-7164" -Dpython.executable="C:\stuff\jython\jython-7164\jython.bat" -classpath "C:\stuff\jython\jython-7164\jython.jar" org.python.util.jython -c "import sys; print sys.argv" "c:\Program Files\some\" passed args: -c import sys; print sys.argv c:\Program Files\some" parsed arguments: -c c:\Program Files\some" executing import sys; print sys.argv ['-c', 'c:\\Program Files\\some"'] So I am sorry to say there is not much jython can do about this at the moment. There is a little chance that it is the java interpreter's fault, in which case a native launcher would help. Workaround: C:\stuff\jython\jython-7164>jython.bat -c "import sys; print sys.argv" "c:\Program Files\some\\" passed args: -c import sys; print sys.argv c:\Program Files\some\ parsed arguments: -c c:\Program Files\some\ executing import sys; print sys.argv ['-c', 'c:\\Program Files\\some\\'] |
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-23 07:07:42 | otmarhumbel | set | status: open -> closed resolution: wont fix messages: + msg6204 |
2010-10-23 06:31:38 | otmarhumbel | set | messages: + msg6203 |
2010-06-29 09:56:50 | otmarhumbel | set | messages: + msg5860 |
2010-06-29 09:38:42 | SchlauFuchs | set | messages: + msg5859 |
2010-06-29 09:26:40 | otmarhumbel | set | messages: + msg5858 |
2010-06-29 09:19:46 | SchlauFuchs | set | messages: + msg5857 |
2010-06-29 09:14:22 | otmarhumbel | set | messages: + msg5856 |
2010-06-29 08:34:41 | SchlauFuchs | set | messages: + msg5855 |
2010-06-29 06:17:34 | otmarhumbel | set | nosy:
+ otmarhumbel messages: + msg5853 |
2010-06-29 04:19:37 | SchlauFuchs | create |
Supported by Python Software Foundation,
Powered by Roundup