[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

java+jython: ImportError: cannot import name newString

Hi java packagers,

I need some help to understand an issue I have while trying to package a
java app which exec some jython script.

I came up with the attached simple test case which I compile using:
$ javac -cp "/usr/share/java/jython.jar" TestJython.java

Then I execute:
$ JYTHONPATH="/usr/share/jython/Lib" \
  /usr/share/java/jna-posix.jar" \
  java TestJython

It gives me the following error:
 Exception in thread "main" Traceback (most recent call last):
   File "<string>", line 1, in <module>
 ImportError: cannot import name newString

$ jython -c "from org.python.core.Py import newString as asPyString"

runs fine.

java and javac are those from java-6-openjdk:
$ readlink -f $(which javac)
$ readlink -f $(which java)

Many thanks in advance,

(Please CC me on replies)

import org.python.util.PythonInterpreter;

public class TestJython {
	private PythonInterpreter py;

	public static void main(String[] args) {
		TestJython tj = new TestJython();
	public void go() {
		py = new PythonInterpreter();
		py.exec("from org.python.core.Py import newString as asPyString");

Attachment: signature.asc
Description: OpenPGP digital signature

Reply to: