Vic Luo created PYLUCENE-35: ------------------------------- Summary: UnicodeEncodeError when a JavaException is raised Key: PYLUCENE-35 URL: https://issues.apache.org/jira/browse/PYLUCENE-35 Project: PyLucene Issue Type: Bug Environment: Arch Linux x86_64 LANG=zh_CN.UTF-8 Reporter: Vic Luo
When a javaException is raised and the stacktrace includes unicode characters, the stacktrace will not be printed. Instead, line 11 of __init__.py will raise a UnicodeEncodingError: !!! File "/usr/lib/python2.7/site-packages/lucene-4.9.0-py2.7-linux-x86_64.egg/lucene/__init__.py", line 17, in __str__!!! !!! return "\n".join((super(JavaError, self).__str__(), " Java stacktrace:", str(writer)))!!! !!!UnicodeEncodeError: 'ascii' codec can't encode characters in position 102-103: ordinal not in range(128)!!! I found a workaround: change that line to return u"\n".join((unicode(super(JavaError, self)), u" Java stacktrace:", unicode(writer))) ,then it could print the correct stacktrace which contains unicode characters in file path. -- This message was sent by Atlassian JIRA (v6.3.4#6332)