From: Travis B. Hartwell <nafai@tr...> - 2007-02-05 20:51:01
For a project at work, we have a custom resource manager we use to
manage resources and files in our J2EE container platform. I'd like to
be able to support loading Jython modules from this resource manager
instead of from the local filesystem directly.
I'm using Jython 2.1 currently (waiting for the next stable build of
Jython to move to the 2.2 series) and I can't find an appropriate way of
doing this. If I try creating my own class loader and setting it via
PySystemState.initialize(), on import of modules, it will try call
findClass() and loadClass() on my class loader. Unfortunately, this is
not quite what I want. I'm not going to be loading a Java class with
this -- I want to be able to load a Python source file from the resource
manager, not a Java class. I see org.python.core.imp.loadFromClassLoader()
in the source, but nothing ever calls this.
What's the appropriate mechanism for doing this? Or is there no easy
way to do this without hacking the Jython code in Jython 2.1?
Travis B. Hartwell
- Read my blog at http://www.travishartwell.net/blog/