Issue
I'm creating a very simple example on OSX with python 2.6 but I keep getting:
Traceback (most recent call last):
File "ssl.py", line 1, in <module>
import socket, ssl
File "/Users/Dennis/ssl.py", line 5, in <module>
sslSocket = ssl.wrap_socket(s)
AttributeError: 'module' object has no attribute 'wrap_socket'
Code:
import socket, ssl
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('irc.freenode.net', 7000))
sslSocket = ssl.wrap_socket(s)
print repr(sslSocket.server())
print repr(sslSocket.issuer())
sslSocket.write('Hello secure socket\n')
s.close()
What am I doing terribly wrong?
Solution
Don't name your script ssl.py
, because when you name your script ssl.py
and you do import ssl
you're importing this same script .
Answered By - mouad
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.