Python 2.7 AttributeError - PullRequest
       28

Python 2.7 AttributeError

0 голосов
/ 09 октября 2018

Я получаю ошибку атрибута и не могу понять, чего мне не хватает, используя Python 2.7.Любые идеи приветствуются, спасибо!

AttributeError: объект 'dict' не имеет атрибута ' self ' error и не может понять, почему?

#!/usr/bin/python
import boto3
r53 = boto3.client('route53')

def paginate(method, **kwargs):
client = method.__self__
paginator = client.get_paginator(method.__name__)
for page in paginator.paginate(**kwargs).result_key_iters():
    for result in page:
        yield result

for key in
paginate(r53.list_resource_record_sets(HostedZoneId='/hostedzone/XXXXXXXXXXX')):
    print(key)

Обновление: включая трассировку стека:

Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", 
line 1591, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", 
line 1018, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Users/juan/Desktop/route53/route53dev.py", line 12, in <module>
    for key in
  paginate(r53.list_resource_record_sets(HostedZoneId='/hostedzone/X')):
  File "/Users/juan/Desktop/route53/route53dev.py", line 6, in paginate
    client = method.__self__
AttributeError: 'dict' object has no attribute '__self__'
...