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

aivarannamaa avataraivarannamaa 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:



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


print >>error, err.message.encode("ascii", "backslashreplace") 

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

Comments (2)

  1. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.