Message3768
From
http://www.nabble.com/problem-with-jython-and-threads-to20371245.html#a20371245:
== 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. |
|
Date |
User |
Action |
Args |
2008-11-09 18:40:57 | cgroves | set | recipients:
+ cgroves |
2008-11-09 18:40:57 | cgroves | set | messageid: <1226256057.24.0.232504578776.issue1169@psf.upfronthosting.co.za> |
2008-11-09 18:40:57 | cgroves | link | issue1169 messages |
2008-11-09 18:40:56 | cgroves | create | |
|