简体   繁体   中英

epydoc AttributeError: 'Text' object has no attribute 'data'

I've not used epydoc in the last 2 years but I found it very handy to take track of my classes and methods with a very little effort.

Today I installed latest version 3.0.1 but I get this error and searching around seems no solutions are provided.

Traceback (most recent call last):-] Parsing docstrings: pyramid.reques... 
  File "/home/neurino/apps/env/bin/epydoc", line 13, in <module>
    cli()
  File "/home/neurino/apps/env/lib/python2.7/site-packages/epydoc/cli.py", line 965, in cli
    main(options, names)
  File "/home/neurino/apps/env/lib/python2.7/site-packages/epydoc/cli.py", line 757, in main
    exclude_parse=exclude_parse)
  File "/home/neurino/apps/env/lib/python2.7/site-packages/epydoc/docbuilder.py", line 275, in build_doc_index
    parse_docstring(val_doc, docindex, suppress_warnings)
  File "/home/neurino/apps/env/lib/python2.7/site-packages/epydoc/docstringparser.py", line 265, in parse_docstring
    api_doc.summary, api_doc.other_docs = api_doc.descr.summary()
  File "/home/neurino/apps/env/lib/python2.7/site-packages/epydoc/markup/restructuredtext.py", line 179, in summary
    try: self._document.walk(visitor)
  File "/home/neurino/apps/env/lib/python2.7/site-packages/docutils/nodes.py", line 137, in walk
    if child.walk(visitor):
  File "/home/neurino/apps/env/lib/python2.7/site-packages/docutils/nodes.py", line 129, in walk
    visitor.dispatch_visit(self)
  File "/home/neurino/apps/env/lib/python2.7/site-packages/docutils/nodes.py", line 1604, in dispatch_visit
    return method(node)
  File "/home/neurino/apps/env/lib/python2.7/site-packages/epydoc/markup/restructuredtext.py", line 307, in visit_paragraph
    m = self._SUMMARY_RE.match(child.data)
AttributeError: 'Text' object has no attribute 'data'

Is epydoc project dead?

I found a patch on epydoc tracker, it was outdated anyway this part solves the problem:

markup/restructuredtext.py
307c307,310
<                 m = self._SUMMARY_RE.match(child.data)
---
>                 try:
>                     m = self._SUMMARY_RE.match(child.data)
>                 except AttributeError:
>                     m = None

Epydoc has not been maintained for long time and the last release is not quite compatible with current Pyton and docutils. It is still a useful tool, though, but needs some patching.

Here are some patches I used with Epydoc to build documentation for my Python 2.7 code: http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/epydoc/ (they are part of the PLD-Linux Epydoc package).

I wish someone takes over the code and continue the development…

Objects can be tested against null (ie None) so that the exception could not be occurred.

if object is None:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM