Thanks Charlie...I was using 2.5b1. It is hard to tell if the bug you linked to is the same thing, but if that is fixed, I can try again with the latest code from trunk. I have worked around this for now by setting CLASSPATH in the environment but will revisit it soon to try to get the dynamic code working. I will try to come up with an isolated case... it's a little tricky because it seems to depend on the interaction of multiple jar files and it's hard to narrow down the exact case.
From: Charlie Groves [mailto:charlie.groves@...]
Sent: Tuesday, January 27, 2009 12:45 AM
To: Christopher Prinos
Subject: Re: [Jython-users] CLASSPATH vs sys.path
On Sun, Jan 25, 2009 at 2:15 PM, Christopher Prinos
> I'm running into a number of import problems when trying to dynamically add jar files or .class file directories to the jython path.
> If I put the .jar on the java classpath (i.e. by setting it in the shell script that launches jython), everything works fine, but if I try to add the .jar to sys.path, I get the following errors on import:
> import my.package.name
> AttributeError: 'javapackage' object has no attribute 'name'
> I tried adding the .jar file via sys.path as well as calls to sys.packageManager.addJar and sys.add_extdir. Neither worked. Googling for the error, I've seen people run into similar problems, but not a solution. It seems like the packages are getting hidden by directories in the java paths that are not python packages.
> If I manually put __init__.py files in the java package directories that contain the .class files, the error goes away, but obviously that doesn't really work for .jar files.
What version of Jython are you using? There was a bug in 2.5b1 with
package scanning that might be affecting you:
If that doesn't seem to be your issue, could you post a jar that isn't
working somewhere? I might be able to track down the problem if I can
reproduce it locally.