#287 api_doc.canonical_name is UNKNOWN

open
Edward Loper
inspection (59)
5
2008-08-19
2008-08-19
Chad Dombrova
No

i've tried my best to get to the bottom of this, but i need some help.

it seems that there are many (several hundred) val_docs whose canonical names are getting through as UNKNOWN.

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Volumes/luma/_globalSoft/dev/chad/python/thirdParty/epydoc/cli.py", line 964, in run
main(options, names)
File "/Volumes/luma/_globalSoft/dev/chad/python/thirdParty/epydoc/cli.py", line 757, in main
exclude_parse=exclude_parse)
File "/Volumes/luma/_globalSoft/dev/chad/python/thirdParty/epydoc/docbuilder.py", line 277, in build_doc_index
parse_docstring(val_doc, docindex, suppress_warnings)
File "/Volumes/luma/_globalSoft/dev/chad/python/thirdParty/epydoc/docstringparser.py", line 184, in parse_docstring
and api_doc.canonical_name[-1] == '__init__'):
AttributeError: _Sentinel instance has no attribute '__getitem__'

strangely, it makes it past the last error if i add a print statement around line 273 of docbuilder.py:

for i, val_doc in enumerate(valdocs):
_report_valdoc_progress(i, val_doc, valdocs)
# the value's docstring
print i, val_doc.canonical_name, val_doc.metadata, isinstance(val_doc, RoutineDoc)

but fails further on:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Volumes/luma/_globalSoft/dev/chad/python/thirdParty/epydoc/cli.py", line 964, in run
main(options, names)
File "/Volumes/luma/_globalSoft/dev/chad/python/thirdParty/epydoc/cli.py", line 757, in main
exclude_parse=exclude_parse)
File "/Volumes/luma/_globalSoft/dev/chad/python/thirdParty/epydoc/docbuilder.py", line 277, in build_doc_index
parse_docstring(val_doc, docindex, suppress_warnings)
File "/Volumes/luma/_globalSoft/dev/chad/python/thirdParty/epydoc/docstringparser.py", line 195, in parse_docstring
for field in STANDARD_FIELDS + user_docfields(api_doc, docindex):
File "/Volumes/luma/_globalSoft/dev/chad/python/thirdParty/epydoc/docstringparser.py", line 615, in user_docfields
for i in range(len(api_doc.canonical_name)-1, 0, -1):
AttributeError: _Sentinel instance has no attribute '__len__'

i'm using just introspection as using parsing in addition to introspect causes merge errors, which i'll post at a later time. and with ignore_hash_conflict set to True i'm back to getting this _Sentinel error again, so i figured i'd start here.

i tried modifying parse_docstring to avoid api_docs whose canonical names are UNKNOWN so that these errors are not raised, but then i end up with errors in the html writer, so i'm assuming that these should not be making it from build_doc_index to parse_docstring.

any advice on how to prevent or track down this error, by either modifying my own code or epydoc's would be greatly appreciated.

i've been using epydoc to document my tool for over a year now and it's the best tool out there by far, but right now i'm very stuck.

this is with epydoc 3.0

Discussion

  • Chad Dombrova
    Chad Dombrova
    2008-08-25

    Logged In: YES
    user_id=1857838
    Originator: YES

    I whittled one "problem" module down to a single line:

    def foo():pass

    if this module is imported elsewhere in my project, i get the following error:

    _Sentinel instance has no attribute '__getitem__'

    this error occurs even if i'm only documenting the module that contains `foo`. if i rename `foo` to `_foo` or i remove the import of this module elsewhere in the project, i stop getting the error.