[Jython-bugs] [issue1169] creating codecs from multiple threads can
lead to incorrect initialization
From: Charles G. <re...@bu...> - 2008-11-09 18:41:05
|
New submission from Charles Groves <cg...@us...>: 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. ---------- components: Core messages: 3768 nosy: cgroves severity: normal status: open title: creating codecs from multiple threads can lead to incorrect initialization _______________________________________ Jython tracker <re...@bu...> <http://bugs.jython.org/issue1169> _______________________________________ |