|
From: <no...@so...> - 2001-01-03 20:05:39
|
Bug #127422, was updated on 2001-Jan-03 09:30
Here is a current snapshot of the bug.
Project: Jython
Category: Core
Status: Open
Resolution: None
Bug Group: None
Priority: 2
Submitted by: nobody
Assigned to : nobody
Summary: Importing java-classes from non-defaul ClassLoaders
Details: I have my own classloader, which loads Jython also.
When I run this
+++++++
package a.b.c
import org.python.util.PythonInterpreter;
import org.python.core.*;
public class Test{
public static void main(String args[]) throws Exception {
PythonInterpreter interp = new PythonInterpreter();
interp.exec("from a.b.c import Test");
interp.exec("s = Test.countLetters('wednesday')");
PyObject x = interp.get("s");
System.out.println("s=" + x);
}
public static String countLetters(String str){
return "Word '"+str+"' has "+ str.length() + " letters";
}
}
++++++++++++++++
I have
"ImportError: no module named a"
But when I explicitly write my.jar(a.b.c.Test) to classpath - everithing is
Ok.
What about usin' Thead.getContextClassLoader() in Py.findClass() or
something?
PS can't register so my e-mail is an...@ib...
Follow-Ups:
Date: 2001-Jan-03 12:05
By: pedronis
Comment:
more a feature request than a bug. (sorry)
notes:
* simply making java loading through 'import' thread-context-class-loader
related: a bad confusing hack, won't do that
* simply setting PySystemState.classLoader at init:
not really a workaround, by now too many jythonc-related
side-effects, e.g. sys.path loading disabled ...
This is part of the poor-man-freezing design issue
(after 2.0):
with jython -jar ... or java -jar ...
what kind of:
python importing
java loading
sys-package-manager init
to offer? ...
-------------------------------------------------------
For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=127422&group_id=12867
|