Boto AttributeError:“模块”对象没有属性“HTTPSConnection”

Posted

技术标签:

【中文标题】Boto AttributeError:“模块”对象没有属性“HTTPSConnection”【英文标题】:Boto AttributeError: 'module' object has no attribute 'HTTPSConnection' 【发布时间】:2021-08-02 21:12:56 【问题描述】:

我在 ubuntu 18.04 和 Google App Engine python2.7 中工作。因为使用 python2.7 我只能使用 boto 而不是 boto3。然而,我收到了这个错误,似乎无法修复它......

ERROR    2021-05-12 12:17:29,792 webapp2.py:1552] 'module' object has no attribute 'HTTPSConnection'
Traceback (most recent call last):
  File "/home/depotter/Downloads/google-cloud-sdk-282.0.0-linux-x86_64/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1535, in __call__
    rv = self.handle_exception(request, response, e)
  File "/home/depotter/Downloads/google-cloud-sdk-282.0.0-linux-x86_64/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1529, in __call__
    rv = self.router.dispatch(request, response)
  File "/home/depotter/Downloads/google-cloud-sdk-282.0.0-linux-x86_64/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/home/depotter/Downloads/google-cloud-sdk-282.0.0-linux-x86_64/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "/home/depotter/Downloads/google-cloud-sdk-282.0.0-linux-x86_64/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/home/depotter/Downloads/google-cloud-sdk-282.0.0-linux-x86_64/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "/home/depotter/projects/mwcentral/server/./online_ordering/ctg/menu.py", line 204, in post
    self.send_menu(company_key, store_id, timestamp)
  File "/home/depotter/projects/mwcentral/server/./online_ordering/ctg/menu.py", line 257, in send_menu
    result = self.upload_menu(menu, company_key_id, store_id)
  File "/home/depotter/projects/mwcentral/server/./online_ordering/ctg/menu.py", line 295, in upload_menu
    key.set_contents_from_string(file)
  File "/home/depotter/projects/mwcentral/lib/boto/s3/key.py", line 1442, in set_contents_from_string
    encrypt_key=encrypt_key)
  File "/home/depotter/projects/mwcentral/lib/boto/s3/key.py", line 1309, in set_contents_from_file
    chunked_transfer=chunked_transfer, size=size)
  File "/home/depotter/projects/mwcentral/lib/boto/s3/key.py", line 762, in send_file
    chunked_transfer=chunked_transfer, size=size)
  File "/home/depotter/projects/mwcentral/lib/boto/s3/key.py", line 963, in _send_file_internal
    query_args=query_args
  File "/home/depotter/projects/mwcentral/lib/boto/s3/connection.py", line 671, in make_request
    retry_handler=retry_handler
  File "/home/depotter/projects/mwcentral/lib/boto/connection.py", line 1071, in make_request
    retry_handler=retry_handler)
  File "/home/depotter/projects/mwcentral/lib/boto/connection.py", line 913, in _mexe
    self.is_secure)
  File "/home/depotter/projects/mwcentral/lib/boto/connection.py", line 705, in get_http_connection
    return self.new_http_connection(host, port, is_secure)
  File "/home/depotter/projects/mwcentral/lib/boto/connection.py", line 755, in new_http_connection
    connection = http_client.HTTPSConnection(
AttributeError: 'module' object has no attribute 'HTTPSConnection'

毫无头绪,感谢任何帮助..

【问题讨论】:

【参考方案1】:

查看这两个链接。它们都适用于 Python2.6,但它们可能类似于 Python2.7 或为您指明正确的方向

    HTTPSConnection module missing in Python 2.6 on CentOS 5.2

    https://groups.google.com/g/google-analytics-data-export-api/c/JkGWM10-4Bw?pli=1

【讨论】:

以上是关于Boto AttributeError:“模块”对象没有属性“HTTPSConnection”的主要内容,如果未能解决你的问题,请参考以下文章

使用 Boto3 将 IAM 用户附加到 IAM 组

AttributeError:“模块”对象没有属性“情节”-Seaborn

AttributeError:“模块”对象没有属性“maketrans”

AttributeError:模块“crontab”没有属性“CronSlices”

Python 3.6 AttributeError:模块“statsmodels”没有属性“compat”

如何在 Python 中使用 boto3 模块检查 Redshift 的集群状态?