Closed bmah888 closed 8 years ago
I'm stumbling into this problem and would like a solution. These bugs appear related to this one:
http://bugs.jython.org/issue2143 http://bugs.jython.org/issue2149
The text of these bugs imply that finding stuff in the JAR's Lib/ directory actually does work, however.
Here's a workaround (that I think is better than what @lomaxfrog and I discussed, because it doesn't require unpacking the JAR file to the local filesystem)...put these lines in init.py
:
# Fix for not having $JARFILE/Lib in path
from org.python.util import jython
# We should really do os.path.join(jython()..., 'Lib') here but we can't
# import os;
sys.path.append(jython().getClass().getProtectionDomain().getCodeSource().getLocation().getPath() + '/Lib')
With the lastest changes, I believe this issue has became a non issue. Bruce would you agree ?
Stumbled upon by @lomaxfrog:
Jython ships with a number of Python libraries, such as the json library. For some reason, the jython-standalone bundle (Jython 2.7b4) can't find them, even though they're in the JAR in the
Lib/
directory. We should be able to solve this by adding__pyclasspath__/Lib
tosys.path
like this:But this doesn't work.