On Thu, Nov 6, 2008 at 2:39 PM, ag356 <
gertner@...> wrote:
>
> 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.
Looks like we're not synchronizing properly when initializing the
codec lookup in org.python.core.codecs. I've opened
http://bugs.jython.org/issue1169 to track hunting this down. I
imagine this is something we'll take care of before releasing 2.5, but
I'm not sure how long it will be before someone really takes a look at
it.
Charlie
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users