From: John G. <jgo...@co...> - 2001-11-09 14:44:53
|
bc...@wo... (Finn Bock) writes: > Try calling > > Py.getSystemState().setClassLoader(this.getClass().getClassLoader()); > > It will effectively disable attempts to import java classes from > sys.path and instead only try to load them from the MultiClassLoader. Almost there!! (Thanks to you and Jeff Emanuel for all your help). I have thinks WORKING! but only if I use Jeff's trick of: interp.set("ListBO", this.getClass()). If I try to "import quovix" or "from quovix.business.util import ListBO" from Python after setting the classloader per your instructions, Python gives an "ImportError: no module named quovix". Oddly, it can import things like java.util.Date. I'm unsure why it can't find my own classes -- obviously the MultiClassLoader can because all this stuff is being called from ListBO itself. So it's a bit strange. But I can work around that certainly. Also I'm curious why this works: interp.exec("import ListBOFoo"); Class pclass = (Class) interp.eval("ListBOFoo.ListBOFoo").__tojava__(Class.class); But this doesn't: interp.exec("mod = __import__('ListBOFoo')"); Class pclass = (Class) interp.eval("mod.ListBOFoo").__tojava__(Class.class); The second dies on the eval claiming that there is no such symbol in Python. Not a biggie but a weird thing anyway. Thanks for all your help! -- John |