From: Menelaos P. <mpe...@gm...> - 2013-02-08 13:54:05
|
I am using *org.python.util.PythonInterpreter* to embed Jython<http://www.jython.org/>in a Java application. I am using Jython version *2.5.2*. he python script I am interpreting contains UTF-8 literals and so I've added the Python Source Code Encoding at the top of the script as per PEP-0263 <http://www.python.org/dev/peps/pep-0263/>: # -*- coding: utf-8 -*- My script is compiled as follows: String script = // load from file as a single String ... PythonInterpreter pi = new PythonInterpreter(); PyCode code = pi.compile(script); result = pi.eval(code); However Jython complains with the following trace: [java] ... : encoding declaration in Unicode string [java] at org.python.core.ParserFacade.prepBufReader(ParserFacade.java:277) [java] at org.python.core.ParserFacade.parseExpressionOrModule(ParserFacade.java:119) [java] at org.python.util.PythonInterpreter.compile(PythonInterpreter.java:259) [java] at org.python.util.PythonInterpreter.compile(PythonInterpreter.java:256) [java] at org.python.util.PythonInterpreter.compile(PythonInterpreter.java:250) |