sphinx documentation के अनुसार, .. autoattribute
निर्देश उदाहरण विशेषताओं को दस्तावेज़ करने में सक्षम होना चाहिए। हालांकि, अगर मैं ऐसा ::ऑटोक्लस और इंस्टेंस गुण
.. currentmodule:: xml.etree.ElementTree
.. autoclass:: ElementTree
.. autoattribute:: ElementTree._root
फिर जब निर्माण मैं एक AttributeError मिलती है:
Traceback (most recent call last):etree.ElementTree.ElementTree
File "/Volumes/Raptor/Library/Python/2.7/lib/python/site-packages/sphinx/ext/autodoc.py", line 326, in import_object
obj = self.get_attr(obj, part)
File "/Volumes/Raptor/Library/Python/2.7/lib/python/site-packages/sphinx/ext/autodoc.py", line 232, in get_attr
return safe_getattr(obj, name, *defargs)
File "/Volumes/Raptor/Library/Python/2.7/lib/python/site-packages/sphinx/util/inspect.py", line 70, in safe_getattr
raise AttributeError(name)
AttributeError: _root
भले ही मैं ElementTree
का दृष्टांत और कोशिश करते हैं और _root
विशेषता का उपयोग हालांकि, यह ठीक काम करता है ::
>>> from xml.etree.ElementTree import ElementTree
>>> e = ElementTree()
>>> hasattr(e, '_root')
True
मैं क्या गलत कर रहा हूं?
(मैं वास्तव में मेरे अपने वर्गों में से एक के साथ इस समस्या हो रही है, लेकिन सिर्फ एक उदाहरण के रूप ElementTree वर्ग का उपयोग कर रहा है, क्योंकि यह मानक पुस्तकालय में है)
भी मेरे लिए पुष्टि की। कोई विचार अगर यह तय किया गया था और यदि हां, तो कौन सा संस्करण? – Rafe
@ राफ: बग अभी भी अनसुलझा है। – mzjn