想连接到dynamoDB,出现AttributeError: 'module'对象没有'connect_to_region'属性

2 投票
1 回答
2622 浏览
提问于 2025-04-18 00:21

这是我写的简单代码:

import boto.dynamodb
conn = boto.dynamodb.connect_to_region(
   'us-east-1',
   aws_access_key_id='....',
   aws_secret_access_key='....')
print conn

然后我得到了:

Traceback (most recent call last):
  File "startMarch28.py", line 5, in <module>
    conn = boto.dynamodb.connect_to_region(
AttributeError: 'module' object has no attribute 'connect_to_region'

1 个回答

3

boto==2.2.2这个版本的boto.dynamodb里,没有叫做 connect_to_region() 的函数。

你可以把这个模块升级到最新的版本(2.27.0):

pip install boto --upgrade

撰写回答