From: annegrl <an...@ya...> - 2007-10-01 06:48:15
|
I've seen this error over and over in the forums (cannot import name), but I still haven't found what exactly I'm doing wrong. I'm using a test jar now just to simplify the situation I'm running an Eclipse based Java application, and attempting to run the Python interpreter to run a python script. Here's how I'm setting up the environment: .... Properties props = new Properties(); props.setProperty("python.path", jars); //jars is set to include my TestAnne jar, jython.jar System.setProperty("java.class.path", jars); //just in case PySystemState.initialize(props, System.getProperties(), new String[]()); python = new PythonInterpreter(); ... and the script import: from com.ibm.anne import TestAnne ..but then as it tries to run the script... ImportError: cannot import name TestAnne however this class is defined in a jar in the python.path which I set, and also its jar shows up in sys.path. But for some reason jython is not recognizing it (although I do notice it finds the package, since it's not complaining about the module). This works fine if I point to the directory of the class files instead of jar files. Just something about it being in a jar. Please help! Completely baffled! anne -- View this message in context: http://www.nabble.com/Cannot-import-name...but-jar-in-classpath-tf4546539.html#a12974125 Sent from the jython-dev mailing list archive at Nabble.com. |