I've been experiencing lately with some incredible hard bugs concerning imports in Jython 2.2. (using JDK 1.5.0_04 on linux)

I have a complicated system with lots and lots of jars.
When trying to execute "import sys", the import succeeds, but it imports a weird "java package" object! it has no attributes except for a __name__ attribute (which equals 'sys'). It has nothing to do with the python builtin sys module. (e.g. invoking sys.path will cause an AttributeError)

When inspecting the object in the java debugger, I can get the 'sys' object, and notice that it is a 'PyJavaPackage' object, but it has no way to identify the original package. (actually, it contains a member which might reveal the identity - but how disapointing, it is set to null...)

btw - I don't have ANY package named sys in my java classpath, nor in my python pythonpath.

When running the SAME code using Jython2.1 it works perfectly.
My system depends on Python 2.2 features though (new style classes), so I can't just revert to the old version.

I have tried some other stuff, including retrieving the java package using Package.getPackage("sys") which retruns null...

I feel hopeless!

Anyone has encountered this bug? any workarounds?


Bring words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.