boto3:AttributeError:“module”对象没有“ressou”属性

2024-05-18 11:16:12 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用boto3与我的AWS基础设施交互。 当我直接从python CLI(v 3.6.1)中使用boto3时,以下代码正在工作:

import boto3
client = boto3.ressource('iam')
print(client.User('myusername').arn)

但是,如果我试图从python脚本文件(test.py)中使用它,会得到以下错误:

$ python test.py
Traceback (most recent call last):
File "test.py", line 5, in <module>
client = boto3.ressource('iam')
AttributeError: 'module' object has no attribute 'ressource'

提前谢谢你


Tags: 代码pytestimportclientawscli基础设施