Autodoc problem with TypeError

zabsko avatarzabsko created an issue

Making html code in SA project in most cases produces sth like that:

zaba@SRW001:~/zosia/zosia/public/docs$ make html
sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v0.6.2
loading pickled environment... done
building [html]: targets for 1 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] test                                                                                                                                                        
Exception occurred:
  File "/usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/registry.py", line 194, in _current_obj
    'thread' % self.____name__)
TypeError: No object (name: G) has been registered for this thread
The full traceback has been saved in /tmp/sphinx-err-3f_Bgz.log, if you want to report the issue to the author.
Please also report this if it was a user error, so that a better error message can be provided next time.
Send reports to sphinx-dev@googlegroups.com. Thanks!
make: *** [html] Błąd 1

Mentioned error file here:

zaba@SRW001:~/zosia/zosia/public/docs$ more /tmp/sphinx-err-3f_Bgz.log 
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.5/sphinx/cmdline.py", line 172, in main
    app.build(all_files, filenames)
  File "/usr/lib/pymodules/python2.5/sphinx/application.py", line 130, in build
    self.builder.build_update()
  File "/usr/lib/pymodules/python2.5/sphinx/builders/__init__.py", line 265, in build_update
    'out of date' % len(to_build))
  File "/usr/lib/pymodules/python2.5/sphinx/builders/__init__.py", line 285, in build
    purple, length):
  File "/usr/lib/pymodules/python2.5/sphinx/builders/__init__.py", line 131, in status_iterator
    for item in iterable:
  File "/usr/lib/pymodules/python2.5/sphinx/environment.py", line 519, in update_generator
    self.read_doc(docname, app=app)
  File "/usr/lib/pymodules/python2.5/sphinx/environment.py", line 610, in read_doc
    pub.publish()
  File "/usr/lib/pymodules/python2.5/docutils/core.py", line 204, in publish
    self.settings)
  File "/usr/lib/pymodules/python2.5/docutils/readers/__init__.py", line 69, in read
    self.parse()
  File "/usr/lib/pymodules/python2.5/docutils/readers/__init__.py", line 75, in parse
    self.parser.parse(self.input, document)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/__init__.py", line 157, in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 170, in run
    input_source=document['source'])
  File "/usr/lib/pymodules/python2.5/docutils/statemachine.py", line 232, in run
    context, state, transitions)
  File "/usr/lib/pymodules/python2.5/docutils/statemachine.py", line 420, in check_line
    return method(match, context, next_state)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 2658, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 308, in section
    self.new_subsection(title, lineno, messages)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 376, in new_subsection
    node=section_node, match_titles=1)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 266, in nested_parse
    node=node, match_titles=match_titles)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 195, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/usr/lib/pymodules/python2.5/docutils/statemachine.py", line 232, in run
    context, state, transitions)
  File "/usr/lib/pymodules/python2.5/docutils/statemachine.py", line 420, in check_line
    return method(match, context, next_state)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 2658, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 308, in section
    self.new_subsection(title, lineno, messages)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 376, in new_subsection
    node=section_node, match_titles=1)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 266, in nested_parse
    node=node, match_titles=match_titles)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 195, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/usr/lib/pymodules/python2.5/docutils/statemachine.py", line 232, in run
    context, state, transitions)
  File "/usr/lib/pymodules/python2.5/docutils/statemachine.py", line 420, in check_line
    return method(match, context, next_state)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 2239, in explicit_markup
    nodelist, blank_finish = self.explicit_construct(match)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 2251, in explicit_construct
    return method(self, expmatch)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 1994, in directive
    directive_class, match, type_name, option_presets)
  File "/usr/lib/pymodules/python2.5/docutils/parsers/rst/states.py", line 2043, in run_directive
    result = directive_instance.run()
  File "/usr/lib/pymodules/python2.5/sphinx/ext/autodoc.py", line 1072, in run
    documenter.generate(more_content=self.content)
  File "/usr/lib/pymodules/python2.5/sphinx/ext/autodoc.py", line 617, in generate
    if not self.import_object():
  File "/usr/lib/pymodules/python2.5/sphinx/ext/autodoc.py", line 327, in import_object
    __import__(self.modname)
  File "/home/zaba/zosia/zosia/controllers/sedan_collection.py", line 3, in <module>
    from zosia.lib.sedan.file_saver import *
  File "/home/zaba/zosia/zosia/lib/sedan/file_saver.py", line 2, in <module>
    from zosia.lib.sedan.sql import *
  File "/home/zaba/zosia/zosia/lib/sedan/sql.py", line 4, in <module>
    from zosia.lib.workflow import processRequest
  File "/home/zaba/zosia/zosia/lib/workflow.py", line 7, in <module>
    from zosia.model.jednostka import *
  File "/home/zaba/zosia/zosia/model/jednostka.py", line 12, in <module>
    from zosia.model.obiekt import get_obiekty_from_db as get_obiekty
  File "/home/zaba/zosia/zosia/model/obiekt.py", line 969, in <module>
    rodzaje_obiektow_nr = dict([(x, klasy_rodzaje_obiektow[g.rodzaje_obiektow[x]]) for x in g.rodzaje_obiektow if g.rodzaje_obiektow[x] in klasy_rodzaje_obiektow.keys()])
  File "/usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/registry.py", line 137, in __getattr__
    return getattr(self._current_obj(), attr)
  File "/usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/registry.py", line 194, in _current_obj
    'thread' % self.____name__)
TypeError: No object (name: G) has been registered for this thread

Is it problem with my own code or with autodoc?

Comments (8)

  1. Toshio Kuratomi
    • changed status to open

    Here's a sphinx extension that let's things in my project work. This is almost certainly not complete for all pylons projects. I can go to the TurboGears/pylons people for input about making this complete for all pylons apps (the basic technique is what was used for their nosetest plugin) but conceptually it seems ugly to me. Can you think of a better way to approach this problem or should I continue to work on this?

    http://toshio.fedorapeople.org/pylons_autodoc.py

    Note: This extension addresses another problem when using autodoc with pylons-apps as well. The "import tw.validators" portion of the patch was documented here: http://docs.turbogears.org/1.0/UsingSphinx

  2. Georg Brandl

    Okay, I see the problem now, being in the import itself. Shame on me for not looking at that traceback in more detail. This should now really be fixed in 23d4cf560259 .

    Of course, the build will now emit warnings instead of crashing. I can't comment on your workaround, since I'm not familiar with Pylons myself (though I don't see the reason for the class). It certainly looks involved :)

  3. Toshio Kuratomi

    <nod> I'll have to talk to the TG and pylons people about making it better I think. Get rid of the class and fill out the list of StackedProxyObjects that they create. Not crashing is good but since it still can't import the module, the docstrings still can't be extracted with autodoc which is what I'm aiming for :-).

  4. 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 ProjectModifiedEvent.java.
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.