#351 AttributeError: 'str' object has no attribute 'docstring'

open
nobody
5
2012-02-18
2012-02-18
Martin Ueding
No

I tried to parse pygame/examples/liquid.py with --parse-only and got the following error:

$pydoc --parse-only --debug examples/liquid.py
Error: Internal error during parsing (/home/mu/Branches/pygame/examples/liquid.py, line 63):
'str' object has no attribute 'docstring'
Traceback (most recent call last):
File "/usr/bin/epydoc", line 13, in <module>
cli()
File "/usr/lib/pymodules/python2.7/epydoc/cli.py", line 965, in cli
main(options, names)
File "/usr/lib/pymodules/python2.7/epydoc/cli.py", line 757, in main
exclude_parse=exclude_parse)
File "/usr/lib/pymodules/python2.7/epydoc/docbuilder.py", line 206, in build_doc_index
doc_pairs = _get_docs_from_items(items, options)
File "/usr/lib/pymodules/python2.7/epydoc/docbuilder.py", line 349, in _get_docs_from_items
item, options, progress_estimator))
File "/usr/lib/pymodules/python2.7/epydoc/docbuilder.py", line 549, in _get_docs_from_module_file
filename=filename, context=parent_docs[1])
File "/usr/lib/pymodules/python2.7/epydoc/docparser.py", line 298, in parse_docs
process_file(module_doc)
File "/usr/lib/pymodules/python2.7/epydoc/docparser.py", line 658, in process_file
lineno, comments, decorators, encoding)
File "/usr/lib/pymodules/python2.7/epydoc/docparser.py", line 791, in process_line
return process_docstring(*args)
File "/usr/lib/pymodules/python2.7/epydoc/docparser.py", line 1391, in process_docstring
if prev_line_doc.docstring not in (None, UNKNOWN):
AttributeError: 'str' object has no attribute 'docstring'

I guess that has something to do with the source code at the bottom, but the parser should fail not that hard on that.

Discussion

  • Martin Ueding
    Martin Ueding
    2012-02-18

    liquid.py

     
    Attachments
  • Martin Ueding
    Martin Ueding
    2012-02-18

    When I combine the two document blocks, it works fine.

     
  • There is a patch at https://github.com/JonnyJD/epydoc-m/issues/3

    epydoc-m is a maintenance fork, since the original author seems to be unavailable for now.

    The patch is in the master and stable branches of the fork.