HTTPSConnection module missing in Python 2.6 on Ce

2020-07-06 09:11发布

问题:

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.

When I try running my application I get an error regarding HTTPSConnection being missing: "AttributeError: 'module' object has no attribute 'HTTPSConnection'"

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?

Here's the traceback:

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'

回答1:

citing from the python documentation (http://docs.python.org/library/httplib.html):

Note HTTPS support is only available if the socket module was compiled with SSL support.

You should find out how python on the CentOS you are using was built.



回答2:

Please install openssl and openssl-devel before you install python2.6.

You can simply install those packages using yum, and do a re-install of python2.6 (no need to remove already installed python2.6)

]# yum install openssl openssl-devel

Python-2.6.x]# ./configure
Python-2.6.x]# make && make altinstall


回答3:

How come you have python 2.6? In CentOS 2.4 is standard, this might be the cause of your problem. Might be worth installing boto again as the library paths might not be correct



标签: python centos