Issues

Issue #853 resolved

AttributeError: Reporter instance has no attribute 'locator'

Anonymous created an issue

Hi folk,

I just installed Sphinx 1.1.2 by easy_install, however when i made html against django plain txts, one error occurs. please see the following traceback:

Sphinx version: 1.1.2

Python version: 2.7.1

Docutils version: 0.9 repository

Jinja2 version: 2.6

Traceback (most recent call last): File "C:\Python27\lib\site-packages\sphinx-1.1.2-py2.7.egg\sphinx\cmdline.py", line 189, in main app.build(force_all, filenames) File "C:\Python27\lib\site-packages\sphinx-1.1.2-py2.7.egg\sphinx\application.py", line 204, in build self.builder.build_update() File "C:\Python27\lib\site-packages\sphinx-1.1.2-py2.7.egg\sphinx\builders__init.py", line 196, in build_update 'out of date' % len(to_build)) File "C:\Python27\lib\site-packages\sphinx-1.1.2-py2.7.egg\sphinx\builders__init.py", line 216, in build purple, length): File "C:\Python27\lib\site-packages\sphinx-1.1.2-py2.7.egg\sphinx\builders__init.py", line 120, in status_iterator for item in iterable: File "C:\Python27\lib\site-packages\sphinx-1.1.2-py2.7.egg\sphinx\environment.py", line 613, in update_generator self.read_doc(docname, app=app) File "C:\Python27\lib\site-packages\sphinx-1.1.2-py2.7.egg\sphinx\environment.py", line 761, in read_doc pub.publish() File "C:\Python27\lib\site-packages\docutils\core.py", line 210, in publish self.settings) File "C:\Python27\lib\site-packages\docutils\readers__init.py", line 69, in read self.parse() File "C:\Python27\lib\site-packages\docutils\readers__init.py", line 75, in parse self.parser.parse(self.input, document) File "C:\Python27\lib\site-packages\docutils\parsers\rst__init.py", line 162, in parse self.statemachine.run(inputlines, document, inliner=self.inliner) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 174, in run input_source=document['source']) File "C:\Python27\lib\site-packages\docutils\statemachine.py", line 239, in run context, state, transitions) File "C:\Python27\lib\site-packages\docutils\statemachine.py", line 460, in check_line return method(match, context, next_state) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 2937, in text self.section(title.lstrip(), source, style, lineno + 1, messages) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 331, in section self.new_subsection(title, lineno, messages) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 399, in new_subsection node=section_node, match_titles=1) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 286, in nested_parse node=node, match_titles=match_titles) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 199, in run results = StateMachineWS.run(self, input_lines, input_offset) File "C:\Python27\lib\site-packages\docutils\statemachine.py", line 239, in run context, state, transitions) File "C:\Python27\lib\site-packages\docutils\statemachine.py", line 460, in check_line return method(match, context, next_state) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 2705, in underline self.section(title, source, style, lineno - 1, messages) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 331, in section self.new_subsection(title, lineno, messages) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 399, in new_subsection node=section_node, match_titles=1) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 286, in nested_parse node=node, match_titles=match_titles) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 199, in run results = StateMachineWS.run(self, input_lines, input_offset) File "C:\Python27\lib\site-packages\docutils\statemachine.py", line 239, in run context, state, transitions) File "C:\Python27\lib\site-packages\docutils\statemachine.py", line 460, in check_line return method(match, context, next_state) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 1214, in bullet i, blank_finish = self.list_item(match.end()) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 1237, in list_item node=listitem) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 286, in nested_parse node=node, match_titles=match_titles) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 199, in run results = StateMachineWS.run(self, input_lines, input_offset) File "C:\Python27\lib\site-packages\docutils\statemachine.py", line 245, in run result = state.eof(context) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 2648, in eof self.blank(None, context, None) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 2640, in blank context, self.state_machine.abs_line_number() - 1) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 422, in paragraph textnodes, messages = self.inline_text(text, lineno) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 431, in inline_text return self.inliner.parse(text, lineno, self.memo, self.parent) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 517, in parse lineno) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 779, in interpreted_or_phrase_ref lineno) File "C:\Python27\lib\site-packages\docutils\parsers\rst\states.py", line 835, in interpreted nodes, messages2 = role_fn(role, rawsource, text, lineno, self) File "C:\Python27\lib\site-packages\sphinx-1.1.2-py2.7.egg\sphinx\domains__init.py", line 173, in role_adapter inliner, options, content) File "C:\Python27\lib\site-packages\sphinx-1.1.2-py2.7.egg\sphinx\roles.py", line 130, in call__ set_role_source_info(inliner, lineno, refnode) File "C:\Python27\lib\site-packages\sphinx-1.1.2-py2.7.egg\sphinx\util\nodes.py", line 183, in set_role_source_info inliner.reporter.locator(lineno) AttributeError: Reporter instance has no attribute 'locator'


I doubt the reason is that I separately installed docutils v0.9 before install Sphinx, which lead to the inconsistence between them. Therefore I went througn the source code, and it is a workaround when change wrong code here. {{{

!python

def set_role_source_info(inliner, lineno, node): node.source, node.line = \ inliner.reporter.get_source_and_line(lineno) # old value: locator }}}

However, I get new error when continue to run making html. I also change the following codes: {{{

!python at C:\Python27\Lib\site-packages\Sphinx-1.1.2-py2.7.egg\sphinx\writers

class HTMLTranslator(BaseTranslator): """ Our custom HTML translator. """

def __init__(self, builder, *args, **kwds):
    BaseTranslator.__init__(self, *args, **kwds)
    self.param_separator = None # **add initial value**           
    self._table_row_index = 0 # **add initial value**
    self.highlighter = builder.highlighter
    self.no_smarty = 0

}}}

{{{

!python at C:\Python27\Lib\site-packages\docutils\writers\html4css1

def assemble_parts(self):
    writers.Writer.assemble_parts(self)
    for part in self.visitor_attributes:
        self.parts[part] = ''.join([item for item in getattr(self, part) if item != None]) # **check if value is None, just a workaround**

def astext(self):
    return ''.join(self.head_prefix + self.head
                   + self.stylesheet + self.body_prefix
                   + self.body_pre_docinfo + self.docinfo
                   + [item for item in self.body if item != None] + self.body_suffix) # **check if value is None, just a workaround**

}}}

Thanks for your time, if any reply, please send me(xingang.liao@autonavi.com) email, thanks in advanced.

Leo Liao

Comments (4)

  1. Erik Hetzner

    I get this error with the latest docutils from svn and the latest sphinx.

    • python: 2.7.2
    • OS: Ubuntu 11.04
    • docutils rev: 7314
    • sphinx: 2fd9ac625d53

    Started from a clean virtualenv, installed docutils & sphinx, created a sphinx project using sphinx-quickstart:

    Exception occurred:
      File "/home/egh/test_853/local/lib/python2.7/site-packages/Sphinx-1.2pre_2fd9ac625d53dev_20120116-py2.7.egg/sphinx/util/nodes.py", line 183, in set_role_source_info
        inliner.reporter.locator(lineno)
    AttributeError: Reporter instance has no attribute 'locator'
    The full traceback has been saved in /tmp/sphinx-err-zgDxTk.log, if you want to report the issue to the developers.
    Please also report this if it was a user error, so that a better error message can be provided next time.
    Either send bugs to the mailing list at <http://groups.google.com/group/sphinx-dev/>,
    or report them in the tracker at <http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!
    make: *** [html] Error 1
    
    

    Thank you!

  2. Log in to comment