問題描述
我正在 CentOS 5.2 上使用 Python 應用程序.它使用 Boto 模塊與 Amazon Web Services 進行通信,這需要通過 HTTPS 連接進行通信.
I'm playing around with a Python application on CentOS 5.2. It uses the Boto module to communicate with Amazon Web Services, which requires communication through a HTTPS connection.
當我嘗試運行我的應用程序時,我收到一個關于缺少 HTTPSConnection 的錯誤:"AttributeError: 'module' 對象沒有屬性 'HTTPSConnection'"
When I try running my application I get an error regarding HTTPSConnection being missing: "AttributeError: 'module' object has no attribute 'HTTPSConnection'"
Google 并沒有真正返回任何相關信息,我已經嘗試了大多數解決方案,但都沒有解決問題.
Google doesn't really return anything relevant, I've tried most of the solutions but none of them solve the problem.
有沒有人遇到過類似的事情?
Has anyone come across anything like it?
這是回溯:
Traceback (most recent call last):
File "./chatter.py", line 114, in <module>
sys.exit(main())
File "./chatter.py", line 92, in main
chatter.status( )
File "/mnt/application/chatter/__init__.py", line 161, in status
cQueue.connect()
File "/mnt/application/chatter/tools.py", line 42, in connect
self.connection = SQSConnection(cConfig.get("AWS", "KeyId"), cConfig.get("AWS", "AccessKey"));
File "/usr/local/lib/python2.6/site-packages/boto-1.7a-py2.6.egg/boto/sqs/connection.py", line 54, in __init__
self.region.endpoint, debug, https_connection_factory)
File "/usr/local/lib/python2.6/site-packages/boto-1.7a-py2.6.egg/boto/connection.py", line 418, in __init__
debug, https_connection_factory)
File "/usr/local/lib/python2.6/site-packages/boto-1.7a-py2.6.egg/boto/connection.py", line 189, in __init__
self.refresh_http_connection(self.server, self.is_secure)
File "/usr/local/lib/python2.6/site-packages/boto-1.7a-py2.6.egg/boto/connection.py", line 247, in refresh_http_connection
connection = httplib.HTTPSConnection(host)
AttributeError: 'module' object has no attribute 'HTTPSConnection'
推薦答案
引用自python文檔(http://docs.python.org/library/httplib.html):
citing from the python documentation (http://docs.python.org/library/httplib.html):
注意 HTTPS 支持僅在套接字模塊使用 SSL 支持編譯時可用.
Note HTTPS support is only available if the socket module was compiled with SSL support.
您應該了解您使用的 CentOS 上的 python 是如何構建的.
You should find out how python on the CentOS you are using was built.
這篇關于CentOS 5.2 上的 Python 2.6 中缺少 HTTPSConnection 模塊的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!