bottlenose
bottlenose copied to clipboard
help() causes TypeError
When I call help(amazon)
I get the following error
Python 2.7.2 |EPD 7.1-2 (32-bit)| (default, Jul 27 2011, 13:29:32)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> amazon = bottlenose.Amazon(AMAZON_ACCESS_KEY_ID, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG)
>>> help(amazon)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site.py", line 467, in __call__
return pydoc.help(*args, **kwds)
File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/pydoc.py", line 1727, in __call__
self.help(request)
File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/pydoc.py", line 1771, in help
else: doc(request, 'Help on %s:')
File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/pydoc.py", line 1511, in doc
pager(render_doc(thing, title, forceload))
File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/pydoc.py", line 1488, in render_doc
if name and '.' in name:
TypeError: argument of type 'AmazonCall' is not iterable
The problem is that AmazonCall.__getattr__
interprets Amazon.__name__
as an Amazon API call instead of raising AttributeError
. Pydoc calls __name__
expecting to receive either a string or AttributeError
, which leads to the error in the traceback. Perhaps double-underscore methods should be exempt from the special __getattr__
handling.
Hi, is this still relevant or has it been resolved?
Any updates on this issue?
Does this still happen on today's Python 2.7.15 and Python 3.7.1?