Issue1776

classification
Title: Packages in JARs that are dynamically added to sys.path cannot be imported
Type: behaviour Severity: critical
Components: Core Versions: Jython 2.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: djain, fwierzbicki
Priority: high Keywords:

Created on 2011-07-22.15:33:53 by djain, last changed 2013-02-25.18:36:41 by fwierzbicki.

Messages
msg6577 (view) Author: Dominik Jain (djain) Date: 2011-07-22.15:33:52
Adding a JAR file to the classpath by appending its location to sys.path does not make the packages contained in the JAR available.

I thought this was related to #1455, which was supposedly fixed, but it doesn't work. In Jython 2.2, if somelib.jar was located in /path/to/somelib.jar and contained the package somepackage, one could do the following:

import sys
sys.path.append("/path/to/somelib.jar")
import somepackage

This will not work in either Jython 2.5.1 or 2.5.2 (somepackage is not available). 
However, if the class files are not in a JAR but in a directory, e.g. /path/to/somebin, it will also work with the two new releases:

import sys
sys.path.append("/path/to/somebin")
import somepackage

Works fine. 

You can try this with any JAR. So far I haven't found one I could import with 2.5.1/2.5.2.

Because the issue breaks backward compatibility with Jython 2.2 and I am unaware of an equally simple way of dynamically loading JARs, I consider this to be critical.
msg6588 (view) Author: Dominik Jain (djain) Date: 2011-07-29.12:16:36
I have now tested Jython 2.5.0 and found that the bug was *not* yet present in that version.
msg6589 (view) Author: Dominik Jain (djain) Date: 2011-07-29.12:46:52
I have now found out that the problem also occurs with 2.5.0 if one runs jython from a single JAR that also contains the jython standard library.

The root cause of the problem is the use of a single jython JAR. It makes dynamic imports of other JARs via sys.path impossible.
History
Date User Action Args
2013-02-25 18:36:41fwierzbickisetpriority: high
nosy: + fwierzbicki
versions: + Jython 2.5, - 2.5.1, 2.5.2
2011-07-29 12:46:52djainsetmessages: + msg6589
2011-07-29 12:16:37djainsetmessages: + msg6588
2011-07-22 15:33:53djaincreate