0

I have this python code which getting data from socket's and printing to console. But in working process I getting this error code

Traceback (most recent call last):
  File "server.py", line 1, in <module>
    import ssl, socket
  File "/home/ssl.py", line 20, in <module>
    returned from time.time())
AttributeError: 'module' object has no attribute 'wrap_socket'

maybe somebody has any idea how I can fix this issue?

import ssl, socket
sock = ssl.wrap_socket(socket.socket(), 'server.key', 'server.crt', True)
sock.bind( ('', 443) )
sock.listen(10)
while True:
        conn, addr = sock.accept()
        data = conn.recv(4)
        print data

thank you

admin asd
  • 25
  • 4

1 Answers1

0

You most likely have a file named ssl.py in the same directory, as indicated by this part of the error:

File "/home/ssl.py", line 20, in returned from time.time())

and the script is trying to import that instead of the system level module. If you cannot change the name of that file, try using absolute and relative imports.

Community
  • 1
  • 1
Teemu Risikko
  • 1,205
  • 11
  • 16