1. Georg Brandl
  2. sphinx-contrib
  3. Issues
Issue #29 resolved

[httpdomain] 'autoflask' directive raises UnicodeDecodeError

Eunchong Yu
created an issue

I'm using Sphinx 1.1.3, sphinxcontrib-httpdomain 1.1.7 on Python 2.7.1.

It seems like {{{AutoflaskDirective.make_rst()}}} couldn't handle non-ascii docstrings correctly.

ADDED: My source codes are written by UTF-8. And I think it isn't Sphinx's bug, because It has no problem unless using {{{autoflask}}} directive. I didn't test that it's the httpdomain's bug, or only the autoflask's fault. I'll verify it and add a result.

Here is a traceback:

{{{

!pytb

Traceback (most recent call last): File ".../lib/python2.7/site-packages/sphinx/cmdline.py", line 189, in main app.build(force_all, filenames) File ".../lib/python2.7/site-packages/sphinx/application.py", line 204, in build self.builder.build_update() File ".../lib/python2.7/site-packages/sphinx/builders/init.py", line 196, in build_update 'out of date' % len(to_build)) File ".../lib/python2.7/site-packages/sphinx/builders/init.py", line 216, in build purple, length): File ".../lib/python2.7/site-packages/sphinx/builders/init.py", line 120, in status_iterator for item in iterable: File ".../lib/python2.7/site-packages/sphinx/environment.py", line 613, in update_generator self.read_doc(docname, app=app) File ".../lib/python2.7/site-packages/sphinx/environment.py", line 761, in read_doc pub.publish() File ".../lib/python2.7/site-packages/docutils/core.py", line 221, in publish self.settings) File ".../lib/python2.7/site-packages/docutils/readers/init.py", line 69, in read self.parse() File ".../lib/python2.7/site-packages/docutils/readers/init.py", line 75, in parse self.parser.parse(self.input, document) File ".../lib/python2.7/site-packages/docutils/parsers/rst/init.py", line 162, in parse self.statemachine.run(inputlines, document, inliner=self.inliner) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 174, in run input_source=document['source']) File ".../lib/python2.7/site-packages/docutils/statemachine.py", line 239, in run context, state, transitions) File ".../lib/python2.7/site-packages/docutils/statemachine.py", line 460, in check_line return method(match, context, next_state) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2706, in underline self.section(title, source, style, lineno - 1, messages) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 331, in section self.new_subsection(title, lineno, messages) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 399, in new_subsection node=section_node, match_titles=True) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 286, in nested_parse node=node, match_titles=match_titles) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 199, in run results = StateMachineWS.run(self, input_lines, input_offset) File ".../lib/python2.7/site-packages/docutils/statemachine.py", line 239, in run context, state, transitions) File ".../lib/python2.7/site-packages/docutils/statemachine.py", line 460, in check_line return method(match, context, next_state) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2279, in explicit_markup nodelist, blank_finish = self.explicit_construct(match) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2291, in explicit_construct return method(self, expmatch) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2034, in directive directive_class, match, type_name, option_presets) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2083, in run_directive result = directive_instance.run() File ".../lib/python2.7/site-packages/sphinxcontrib/autohttp/flask.py", line 117, in run nested_parse_with_titles(self.state, result, node) File ".../lib/python2.7/site-packages/sphinx/util/nodes.py", line 74, in nested_parse_with_titles return state.nested_parse(content, 0, node, match_titles=1) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 286, in nested_parse node=node, match_titles=match_titles) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 199, in run results = StateMachineWS.run(self, input_lines, input_offset) File ".../lib/python2.7/site-packages/docutils/statemachine.py", line 239, in run context, state, transitions) File ".../lib/python2.7/site-packages/docutils/statemachine.py", line 460, in check_line return method(match, context, next_state) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2279, in explicit_markup nodelist, blank_finish = self.explicit_construct(match) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2291, in explicit_construct return method(self, expmatch) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2034, in directive directive_class, match, type_name, option_presets) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2083, in run_directive result = directive_instance.run() File ".../lib/python2.7/site-packages/sphinx/domains/init.py", line 190, in run return BaseDirective.run(self) File ".../lib/python2.7/site-packages/sphinx/directives/init.py", line 164, in run self.state.nested_parse(self.content, self.content_offset, contentnode) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 286, in nested_parse node=node, match_titles=match_titles) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 199, in run results = StateMachineWS.run(self, input_lines, input_offset) File ".../lib/python2.7/site-packages/docutils/statemachine.py", line 245, in run result = state.eof(context) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2649, in eof self.blank(None, context, None) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2641, in blank context, self.state_machine.abs_line_number() - 1) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 422, in paragraph textnodes, messages = self.inline_text(text, lineno) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 431, in inline_text return self.inliner.parse(text, lineno, self.memo, self.parent) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 529, in parse processed += self.implicit_inline(remaining, lineno) File ".../lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 996, in implicit_inline return [nodes.Text(unescape(text), rawsource=unescape(text, 1))] File ".../lib/python2.7/site-packages/docutils/nodes.py", line 332, in new return reprunicode.new(cls, data) UnicodeDecodeError: 'ascii' codec can't decode byte 0xea in position 0: ordinal not in range(128) }}}

Comments (3)

  1. Log in to comment