Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
shimizukawa opened this issue Jan 2, 2015 · 3 comments

Comments

@shimizukawa
Copy link
Member

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.


@shimizukawa
Copy link
Member Author

From Georg Brandl on 2011-09-21 08:45:19+00:00

Fix #767: safely encode SphinxErrors when printing to sys.stderr.

→ <>

@shimizukawa
Copy link
Member Author

From Georg Brandl on 2011-09-21 08:47:52+00:00

Fix #767: safely encode SphinxErrors when printing to sys.stderr.

→ <<cset 1977558>>

@shimizukawa
Copy link
Member Author

From Georg Brandl on 2014-10-18 07:32:19+00:00

Removing version: 1.0.7 (automated comment)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant