Issue1599012
Created on 2006-11-18.22:46:40 by cgroves, last changed 2007-02-15.21:45:50 by cgroves.
Messages | |||
---|---|---|---|
msg1276 (view) | Author: Charlie Groves (cgroves) | Date: 2006-11-18.22:46:40 | |
On startup, Jython prefixes all the entries in sys.path with the directory it starts in. |
|||
msg1277 (view) | Author: Paul Drummond (pdrummond) | Date: 2006-11-20.21:09:52 | |
Here's more background info on how this strange behaviour came to be from the mailing list (I would have just linked to the post online rather than paste it here but sourceforge archives are out-of-date. In the DeveloperGuide it says to make the following script to run jython: -------------------- #!/bin/sh exec java -Dpython.home=<path>/dist/ -jar <path>/dist/jython.jar $* -------------------- Well, by going down this route I get into many problems which would take a while to explain! What I have done instead is the following: -------------------- exec java -Dpython.path=/home/pdrummond/bin/Python-2.3.6/Lib -jar /home/pdrummond/src/jython/2.3/dist/jython.jar $* -------------------- Rather than specify python.home I have just set the python path to point to the python lib directory. This works as I can successfully run dist/Lib/test/regrtest.py now. However, when I inspect the sys.path in the jython console, the output is weird: ---------------------------- dist> jython Jython 2.3a0 on java1.5.0_08 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> >>> import sys.path; print sys.path ['', '/home/pdrummond/src/jython/2.3/dist/.', '/home/pdrummond/src/jython/2.3/dist/Lib', '/home/pdrummond/bin/Python-2.3.6/Lib', '/home/pdrummond/src/jython/2.3/dist/__classpath__'] >>> >>> ---------------------------- Looks like "/home/pdrummond/src/jython/2.3/dist is being prefixed to everything! If I remove the python.path property from the exec script and instead specify python.path in the registry file then everything works fine: ---------------------------- bash> cat bin/jython #!/bin/sh exec java -jar /home/pdrummond/src/jython/2.3/dist/jython.jar $* bash> head 2.3/dist/registry # Python Registry -*- ksh -*- # This default registry sets many common options to their default values # All of these settings could be erased with no change in behavior python.path=/home/pdrummond/Python-2.3.6/Lib bash> jython Jython 2.3a0 on java1.5.0_08 (JIT: null) >>> >>> import sys;print sys.path ['', '.', '/home/pdrummond/src/jython/2.3/dist/Lib', '/home/pdrummond/Python-2.3.6/Lib', '__classpath__'] >>> >>> ---------------------------- Note that I must put the registry file in "dist" for jython to pick it up. To summarize, specifying python.path in the registry works but specifying it as a property doesn't! Cheers, Paul Drummond ------------------------------------------------------------------------- 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-dev mailing list Jython-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jython-dev |
|||
msg1278 (view) | Author: Henrik Eriksson (h_eriksson) | Date: 2006-12-05.08:12:39 | |
I'm looking at this one. |
|||
msg1279 (view) | Author: Henrik Eriksson (h_eriksson) | Date: 2006-12-15.07:44:56 | |
All paths in sys.path are converted to absolute paths in site.py. We could just filter out '.' and '__classpath__' in there, but I don't know if it will make any difference, so I'm leaving that one for someone else at the moment. |
|||
msg1280 (view) | Author: Charlie Groves (cgroves) | Date: 2007-01-31.05:34:41 | |
I'm not sure the prefixing is actually a bug. site.py probably wants to prefix these things so if the current directory changes, sys.path still works. It's only weird because '.' is in the path by default which isn't the case in CPython and '__classpath__' is a Jython import hook not a real path. I'm thinking dropping the . from the default path and special casing __classpath__ in site.py is the right way to go to make this seem a little less weird. |
|||
msg1281 (view) | Author: Charlie Groves (cgroves) | Date: 2007-01-31.05:38:36 | |
__classpath__ special cased in r3069 |
|||
msg1282 (view) | Author: Charlie Groves (cgroves) | Date: 2007-02-15.21:45:50 | |
Removed '.' from default path in r3109. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2006-11-18 22:46:40 | cgroves | create |
Supported by Python Software Foundation,
Powered by Roundup