Re: jython 'utf8 encoding not found error

Jeff Emanuel <[email protected]>
Newsgroups gmane.comp.lang.jython.user
Message-ID <[email protected]>
WFM in 2.5.3 in the jython console and in the interpreter embedded in my app.
It's likely a configuration error.

It looks like the encodings are loaded via

                 imp.load("encodings");

Can you explicitly import encodings?  If not that might give a clue.  Try turning python.verbose
up to debug for detailed import messages.

pythonInterpreter.exec("import encodings");


On 2/4/2015 2:09 AM, Rados?aw Madej wrote:
>
> Hi,
>
> I have a problem with jython 'utf8' encoding.
>
> The Jython version I am using is 2.5.3, embedded in my web application. After doing this in my Java code:
>
> PythonInterpreter  pythonInterpreter=  new  PythonInterpreter();
> pythonInterpreter.exec("import codecs");
> pythonInterpreter.exec("codecs.getreader('utf8')");
>
> Such an error occurs:
>
> File  "<string>",  line1,  in  <module>
> File  "__pyclasspath__/codecs$py.class",  line920,  in  getreader
> LookupError:  no  codec search functions registered:  can't find encoding'utf8'
>
> How can the reader with 'utf8' encoding be obtained properly?
>
> According to the python documentation, there should be 'utf8' encoding available in codecs module: https://docs.python.org/2/library/codecs.html#standard-encodings (lower / upper case and hyphen / underscore are all allowed).
>
> I use Windows 7, java 1.7.0_71. OS should not matter I guess - this is the web application run on jboss (version 7.2).
>
> I've also posted the question to the stackoverflow, but no answers yet...:
>
> http://stackoverflow.com/questions/28303395/how-to-obtain-utf-8-reader-in-pythoninterpreter-jython
>
> Br,
>
> Radek
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
>
>
> _______________________________________________
> Jython-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jython-users

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/

_______________________________________________
Jython-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.