|
From: <no...@so...> - 2001-05-10 10:59:09
|
Bugs item #227422, was updated on 2001-01-03 09:30 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=112867&aid=227422&group_id=12867 Category: Core Group: None Status: Closed Resolution: Later Priority: 2 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: Importing java-classes from non-defaul ClassLoaders Initial Comment: 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... ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2001-05-10 03:59 Message: Logged In: NO This is also a problem when trying to embed Jython (2.0) into the JVM of Oracle8iR3: java.lang.SecurityException: relative pathnames are not allowed(./JythonOracle) at oracle.aurora.rdbms.SecurityManagerImpl.checkFileIsAbsolute(SecurityManagerImpl.java) at oracle.aurora.rdbms.SecurityManagerImpl.checkRead(SecurityManagerImpl.java) at java.io.File.isDirectory(File.java) at org.python.core.imp.loadFromPath(imp:285) at org.python.core.imp.loadFromPath(imp:252) at org.python.core.imp.load(imp:357) at org.python.core.imp.load(imp:376) at org.python.core.imp.importName(imp:447) at org.python.core.imp.importName(imp:509) at org.python.core.ImportFunction.load(__builtin__:967) at org.python.core.ImportFunction.__call__(__builtin__:961) at org.python.core.PyObject.__call__(PyObject:250) at org.python.core.__builtin__.__import__(__builtin__:921) at org.python.core.imp.importAll(imp:592) at org.python.pycode._pyx0.f$0(<string>) at org.python.pycode._pyx0.call_function(<string>) at org.python.core.PyTableCode.call(PyTableCode:155) at org.python.core.Py.runCode(Py:1055) at org.python.core.Py.exec(Py:1076) at org.python.util.PythonInterpreter.exec(PythonInterpreter:135) at SimpleEmbedded.getresult(SimpleEmbedded:17) ---------------------------------------------------------------------- Comment By: Finn Bock (bckfnn) Date: 2001-01-12 04:05 Message: This feature request is described in a new task (#24502) : "Loading java classes from other sources" The bug report will be closed. ---------------------------------------------------------------------- Comment By: Samuele Pedroni (pedronis) Date: 2001-01-03 12:05 Message: 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? ... ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=112867&aid=227422&group_id=12867 |