From: SourceForge.net <no...@so...> - 2006-11-20 21:09:53
|
Bugs item #1599012, was opened at 2006-11-18 22:46 Message generated for change (Comment added) made by pdrummond You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1599012&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core Group: targeted for 2.2beta1 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Charles Groves (cgroves) Assigned to: Nobody/Anonymous (nobody) Summary: current directory is prepended to entries in sys.path Initial Comment: On startup, Jython prefixes all the entries in sys.path with the directory it starts in. ---------------------------------------------------------------------- Comment By: Paul Drummond (pdrummond) Date: 2006-11-20 21:09 Message: Logged In: YES user_id=554191 Originator: NO 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 Jyt...@li... https://lists.sourceforge.net/lists/listinfo/jython-dev ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1599012&group_id=12867 |