OK some more info:

This doesn't work:

.. autoclass:: aws.DebugMethodMixin

     This class is to simplify logging and to use the :meth:`shutdown`
to simplify the :meth:`~Axon.Component.component.main` method

    .. automethod:: debug

    .. automethod:: info

    .. automethod:: error

    .. automethod:: shutdown

        This is used in the :meth:`~Axon.Component.component.main`
method to simplify checking for shutdown control messages. Use it like
this:

        .. code-block:: python

            def main():
                while not self.shutdown():
                    # do stuff
                    yield 1

However if you add :members: to the autoclass it's fine:

.. autoclass:: aws.DebugMethodMixin
    :members:

... SNIP ...

This is the offending code (starts line 305 in autodoc.py):

if path:
    mod_cls = path
else:
    # if documenting a class-level object without path, there must be
a
    # current class, either from a parent auto directive ...
    if hasattr(env, 'autodoc_current_class'):
        mod_cls = env.autodoc_current_class
    # ... or from a class directive
    if not mod_cls:
        mod_cls = env.currclass

Ben


On 8 Oct, 11:14, "Ben Ford" <[EMAIL PROTECTED]> wrote:
> Hi Guys,
>
> I've had a traceback trying to autodoc a class in a module's __init__.py. It
> was working before and I added some other :class:`...` directives above the
> bit that's broken. There's probably some user error involved here, but an
> UnboundLocalError sounds like something that should be fixed!
>
> Here's the traceback:
> Traceback (most recent call last):
>   File
> "/usr/lib/python2.5/site-packages/Sphinx-0.4.2-py2.5.egg/sphinx/__init__.py",
> line 131, in main
>     app.builder.build_all()
>   File
> "/usr/lib/python2.5/site-packages/Sphinx-0.4.2-py2.5.egg/sphinx/builder.py",
> line 174, in build_all
>     self.build(None, summary='all source files', method='all')
>   File
> "/usr/lib/python2.5/site-packages/Sphinx-0.4.2-py2.5.egg/sphinx/builder.py",
> line 217, in build
>     for docname in self.status_iterator(iterator, 'reading... ', purple):
>   File
> "/usr/lib/python2.5/site-packages/Sphinx-0.4.2-py2.5.egg/sphinx/builder.py",
> line 115, in status_iterator
>     for item in iterable:
>   File
> "/usr/lib/python2.5/site-packages/Sphinx-0.4.2-py2.5.egg/sphinx/environment.py",
> line 447, in update
>     self.read_doc(docname, app=app)
>   File
> "/usr/lib/python2.5/site-packages/Sphinx-0.4.2-py2.5.egg/sphinx/environment.py",
> line 485, in read_doc
>     reader=SphinxStandaloneReader())
>   File "/usr/lib/python2.5/site-packages/docutils/core.py", line 462, in
> publish_doctree
>     output = pub.publish(enable_exit_status=enable_exit_status)
>   File "/usr/lib/python2.5/site-packages/docutils/core.py", line 204, in
> publish
>     self.settings)
>   File "/usr/lib/python2.5/site-packages/docutils/readers/__init__.py", line
> 71, in read
>     self.parse()
>   File "/usr/lib/python2.5/site-packages/docutils/readers/__init__.py", line
> 77, in parse
>     self.parser.parse(self.input, document)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/__init__.py",
> line 155, in parse
>     self.statemachine.run(inputlines, document, inliner=self.inliner)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 171, in run
>     input_source=document['source'])
>   File "/usr/lib/python2.5/site-packages/docutils/statemachine.py", line
> 234, in run
>     context, state, transitions)
>   File "/usr/lib/python2.5/site-packages/docutils/statemachine.py", line
> 422, in check_line
>     return method(match, context, next_state)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 2844, in text
>     self.section(title.lstrip(), source, style, lineno + 1, messages)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 309, in section
>     self.new_subsection(title, lineno, messages)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 377, in new_subsection
>     node=section_node, match_titles=1)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 267, in nested_parse
>     node=node, match_titles=match_titles)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 196, in run
>     results = StateMachineWS.run(self, input_lines, input_offset)
>   File "/usr/lib/python2.5/site-packages/docutils/statemachine.py", line
> 234, in run
>     context, state, transitions)
>   File "/usr/lib/python2.5/site-packages/docutils/statemachine.py", line
> 422, in check_line
>     return method(match, context, next_state)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 2619, in underline
>     self.section(title, source, style, lineno - 1, messages)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 309, in section
>     self.new_subsection(title, lineno, messages)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 377, in new_subsection
>     node=section_node, match_titles=1)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 267, in nested_parse
>     node=node, match_titles=match_titles)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 196, in run
>     results = StateMachineWS.run(self, input_lines, input_offset)
>   File "/usr/lib/python2.5/site-packages/docutils/statemachine.py", line
> 234, in run
>     context, state, transitions)
>   File "/usr/lib/python2.5/site-packages/docutils/statemachine.py", line
> 422, in check_line
>     return method(match, context, next_state)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 2200, in explicit_markup
>     nodelist, blank_finish = self.explicit_construct(match)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 2212, in explicit_construct
>     return method(self, expmatch)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 1974, in directive
>     directive_function, match, type_name, option_presets)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 2019, in run_directive
>     self.state_machine)
>   File
> "/usr/lib/python2.5/site-packages/Sphinx-0.4.2-py2.5.egg/sphinx/ext/autodoc.py",
> line 542, in autoclass_directive
>     return _auto_directive(*args, **kwds)
>   File
> "/usr/lib/python2.5/site-packages/Sphinx-0.4.2-py2.5.egg/sphinx/ext/autodoc.py",
> line 531, in _auto_directive
>     state.nested_parse(result, 0, node)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 267, in nested_parse
>     node=node, match_titles=match_titles)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 196, in run
>     results = StateMachineWS.run(self, input_lines, input_offset)
>   File "/usr/lib/python2.5/site-packages/docutils/statemachine.py", line
> 234, in run
>     context, state, transitions)
>   File "/usr/lib/python2.5/site-packages/docutils/statemachine.py", line
> 422, in check_line
>     return method(match, context, next_state)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 2200, in explicit_markup
>     nodelist, blank_finish = self.explicit_construct(match)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 2212, in explicit_construct
>     return method(self, expmatch)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 1974, in directive
>     directive_function, match, type_name, option_presets)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 2019, in run_directive
>     self.state_machine)
>   File
> "/usr/lib/python2.5/site-packages/Sphinx-0.4.2-py2.5.egg/sphinx/directives/desc.py",
> line 485, in desc_directive
>     state.nested_parse(content, content_offset, subnode)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 267, in nested_parse
>     node=node, match_titles=match_titles)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 196, in run
>     results = StateMachineWS.run(self, input_lines, input_offset)
>   File "/usr/lib/python2.5/site-packages/docutils/statemachine.py", line
> 234, in run
>     context, state, transitions)
>   File "/usr/lib/python2.5/site-packages/docutils/statemachine.py", line
> 422, in check_line
>     return method(match, context, next_state)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 2200, in explicit_markup
>     nodelist, blank_finish = self.explicit_construct(match)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 2212, in explicit_construct
>     return method(self, expmatch)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 1974, in directive
>     directive_function, match, type_name, option_presets)
>   File "/usr/lib/python2.5/site-packages/docutils/parsers/rst/states.py",
> line 2019, in run_directive
>     self.state_machine)
>   File
> "/usr/lib/python2.5/site-packages/Sphinx-0.4.2-py2.5.egg/sphinx/ext/autodoc.py",
> line 536, in auto_directive
>     return _auto_directive(*args, **kwds)
>   File
> "/usr/lib/python2.5/site-packages/Sphinx-0.4.2-py2.5.egg/sphinx/ext/autodoc.py",
> line 507, in _auto_directive
>     lineno, filename_set=filename_set)
>   File
> "/usr/lib/python2.5/site-packages/Sphinx-0.4.2-py2.5.egg/sphinx/ext/autodoc.py",
> line 313, in generate_rst
>     if not mod_cls:
> UnboundLocalError: local variable 'mod_cls' referenced before assignment
>
> I'd be happy to answer any questions and I'll also see if I can nail down
> what's going wrong a bit better too!
>
> Cheers,
> Ben
>
> --
> Regards,
> Ben Ford
> [EMAIL PROTECTED]
> +447792598685
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to