首页 > 解决方案 > Boto AttributeError:“模块”对象没有属性“HTTPSConnection”

问题描述

我在 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'

绝对一无所知,任何帮助表示赞赏..

标签: python-2.7google-app-engineboto

解决方案


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

  1. CentOS 5.2 上的 Python 2.6 中缺少 HTTPSConnection 模块

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


推荐阅读