我在两个环境中有相同的Python脚本。其中一个很好,但在另一个日志中我发现了这个错误:
15-May-2017 15:29:39 | Type: <class 'AttributeError'>
15-May-2017 15:29:39 | Args: ("'module' object has no attribute 'Retry'",)
我认为它来自以下几个方面:
^{pr2}$不幸的是,这个错误没有告诉我太多,所以我真的不知道该怎么做。在
有人有什么建议吗?或者你能看到代码有什么问题吗?在
16-May-2017 07:33:23 | -----------------------------------------------------------------------------------------
16-May-2017 07:33:23 | Initialising get_usage
16-May-2017 07:33:23 | -----------------------------------------------------------------------------------------
16-May-2017 07:33:23 | net = testnet
16-May-2017 07:33:23 | manager_url = https://xxx.xxx.xxx.xxx/manager/api/json/1.0/list.adm
16-May-2017 07:33:23 | storage_endpoint = endpoint_url
16-May-2017 07:33:23 | storage_bucket = bucket_url
16-May-2017 07:33:23 | Calling https://xxx.xxx.xxx.xxx/manager/api/json/1.0/list.adm
16-May-2017 07:33:23 | [GET] -> https://xxx.xxx.xxx.xxx/manager/api/json/1.0/list.adm
16-May-2017 07:33:23 | Starting new HTTPS connection (1): xxx.xxx.xxx.xxx
16-May-2017 07:33:23 | https://xxx.xxx.xxx.xxx:443 "GET /manager/api/json/1.0/list.adm HTTP/1.1" 200 1473
16-May-2017 07:33:23 | |- OK
16-May-2017 07:33:23 | Type: <class 'AttributeError'>
16-May-2017 07:33:23 | Args: ("'module' object has no attribute 'Retry'",)
16-May-2017 07:33:23 | -------------------------------------------------------------------------------
16-May-2017 07:33:23 | Finished
16-May-2017 07:33:23 | -------------------------------------------------------------------------------
16-May-2017 07:33:23 | -------------------------------------------------------------------------------
16-May-2017 07:33:23 | Uploading file /opt/billing/bin/get_usage/get-usage.debug
16-May-2017 07:33:23 | -------------------------------------------------------------------------------
16-May-2017 07:33:23 | Type: <class 'AttributeError'>
16-May-2017 07:33:23 | Args: ("'module' object has no attribute 'Retry'",)
作为进一步的测试,如果我在Pyhon执行以下操作:
>>> import minio
>>> from minio import Minio
>>> Minio("url", "access_key", "secret_key", False)
我得到以下信息:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/minio/api.py", line 152, in __init__
retries=urllib3.Retry(
AttributeError: 'module' object has no attribute 'Retry'
但如果我使用boto3:
>>> import boto3
>>> s3client = boto3.client('s3', endpoint_url='https://url',
aws_access_key_id = 'access_key',
aws_secret_access_key = 'secret_key')
print(s3client.list_buckets())
我得到一个json响应。在
看起来一个包有效,另一个不行
这解决了问题:
我当时在:
^{pr2}$我现在开始:
谢谢你的帮助。在
minio
和urllib3
模块之间不匹配。要么urllib3
在显示问题的计算机上已过时,要么您有一个浮动的urllib3.py
文件,它不是实际的模块。在相关问题 更多 >
编程相关推荐