'module' object has no attribute 'ssl'

502 views
Skip to first unread message

Niurka Perez

unread,
Jun 21, 2006, 11:20:05 AM6/21/06
to pytho...@python.org
Hi,

I have Red Hat Linux 3.2.3-54 and Python 2.4.3 (the
original version downloaded from python.org) and I'm
using httplib to make a request to an external server,
this is the code I'm using:

import httplib
https = httplib.HTTPSConnection('216.220.59.211',
7989)
https.debuglevel = 1
body = buildXML(data)
try:
https.request('POST', '/Messenger/XMLMessenger',
body)
response = https.getresponse()
response = response.read()
https.close()
except:
response = None
import traceback
traceback.print_exc()
return response


And I get the following error:

Traceback (most recent call last):
File "testPayment.py", line 14, in preAuthPayment
https.request('POST', '/Messenger/XMLMessenger',
body)
File "/usr/local/lib/python2.4/httplib.py", line
804, in request
self._send_request(method, url, body, headers)
File "/usr/local/lib/python2.4/httplib.py", line
827, in _send_request
self.endheaders()
File "/usr/local/lib/python2.4/httplib.py", line
798, in endheaders
self._send_output()
File "/usr/local/lib/python2.4/httplib.py", line
679, in _send_output
self.send(msg)
File "/usr/local/lib/python2.4/httplib.py", line
646, in send
self.connect ()
File "/usr/local/lib/python2.4/httplib.py", line
1073, in connect
ssl = socket.ssl(sock, self.key_file,
self.cert_file)
AttributeError: 'module' object has no attribute 'ssl'

Anybody has an idea of what migth be happening?

Thank in advance.
Best Regards,

Niurka


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Daniel Dittmar

unread,
Jun 21, 2006, 12:01:20 PM6/21/06
to
Niurka Perez wrote:
> ssl = socket.ssl(sock, self.key_file,
> self.cert_file)
> AttributeError: 'module' object has no attribute 'ssl'

The socket module failed to import the _ssl module. And the ssl function
gets only defined if _ssl could be imported.

You probably haven't installed the OpenSSL-dev rpm. When the Python
configure couldn't find the SSL header files, it struck _ssl from the
list of compilable modules.

Daniel

Reply all
Reply to author
Forward
0 new messages