Issue #767 resolved

Crash, when source fragment in error message contains non-ascii characters

created an issue

When sphinx-build is invoked with -W, then following mistakes in source cause sphinx to crash instead of displaying nice error message:

Missing empty line: {{{ .. sourcecode:: python for i in range(a,b): # käsud }}}

Too short section underline: {{{ Lisanäited


Warning, treated as error:
Traceback (most recent call last):
File "c:\python27\scripts\", line 8, in
load_entry_point('Sphinx==1.0.7', 'console_scripts', 'sphinx-
File "c:\python27\lib\site-packages\sphinx-1.0.7-py2.7.egg\sphinx"
, line 67, in main
return cmdline.main(argv)
File "c:\python27\lib\site-packages\sphinx-1.0.7-py2.7.egg\sphinx
line 212, in main
print >>error, err
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in
position 202
ordinal not in range(128) }}}

Workaround: change line 212 in from {{{ print >>error, err }}} to {{{ print >>error, err.message.encode("ascii", "backslashreplace") }}}

If sphinx-build is invoked without -W, then error message is displayed fine.

Comments (4)

  1. Log in to comment