'module' object has no attribute 'ssl'

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Niurka Perez

    #1

    'module' object has no attribute 'ssl'

    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.HTTPSCo nnection('216.2 20.59.211',
    7989)
    https.debugleve l = 1
    body = buildXML(data)
    try:
    https.request(' POST', '/Messenger/XMLMessenger',
    body)
    response = https.getrespon se()
    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_requ est(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_outp ut()
    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
    Yahoo Mail: Your smarter, faster, free email solution. Organize your inbox, protect your privacy, and tackle tasks efficiently with AI-powered features and robust security tools.

  • Daniel Dittmar

    #2
    Re: 'module' object has no attribute 'ssl'

    Niurka Perez wrote:[color=blue]
    > ssl = socket.ssl(sock , self.key_file,
    > self.cert_file)
    > AttributeError: 'module' object has no attribute 'ssl'[/color]

    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

    Comment

    Working...