Hi. Can anyone tell me why the following does not work?
== Begin
import org.python.util.PythonInterpreter;
public class test {
public static void main(String[] args) throws Exception {
for (int i = 0; i < 10; i++) {
new Thread () {
public void run () {
String code = "s = \"Hello " +
Thread.currentThread().getName() +
"\"\nb = unicode(s,\"utf-8\")\nprint b\n";
System.out.println("code:\n"+code);
PythonInterpreter interp = new PythonInterpreter();
interp.exec(code);
}
}.start();
}
}
}
== End
I get "LookupError: no codec search functions registered: can't find
encoding" for usually all but one of the threads. Sometimes two or three of
them work.
If I add "import encodings" to the beginning of the script then it works.
Any help would be greatly appreciated!
--
View this message in context: http://www.nabble.com/problem-with-jython-and-threads-tp20371245p20371245.html
Sent from the jython-users mailing list archive at Nabble.com.
|