Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help() causes TypeError #16

Open
JoshRosen opened this issue Jan 25, 2012 · 3 comments
Open

help() causes TypeError #16

JoshRosen opened this issue Jan 25, 2012 · 3 comments

Comments

@JoshRosen
Copy link

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.

@stephnr
Copy link
Contributor

stephnr commented Apr 8, 2014

Hi, is this still relevant or has it been resolved?

@dlo dlo added the bugs label Apr 24, 2014
@dlo dlo self-assigned this Apr 24, 2014
@stephnr
Copy link
Contributor

stephnr commented Sep 10, 2014

Any updates on this issue?

@dlo dlo modified the milestones: 0.6.5, 1.0.1, 1.0.2 Jul 28, 2016
@dlo dlo added the help wanted label Feb 9, 2017
@dlo dlo removed their assignment Feb 21, 2018
@cclauss
Copy link
Contributor

cclauss commented Dec 3, 2018

Does this still happen on today's Python 2.7.15 and Python 3.7.1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants