Issues

Issue #767 resolved

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

aivarannamaa
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


}}}

Stacktrace:
{{{
Warning, treated as error:
Traceback (most recent call last):
File "c:\python27\scripts\sphinx-build-script.py", line 8, in
<module>
load_entry_point('Sphinx==1.0.7', 'console_scripts', 'sphinx-
build')()
File "c:\python27\lib\site-packages\sphinx-1.0.7-py2.7.egg\sphinx
__init__.py"
, line 67, in main
return cmdline.main(argv)
File "c:\python27\lib\site-packages\sphinx-1.0.7-py2.7.egg\sphinx
\cmdline.py",
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 cmdline.py 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