'module' object has no attribute 'wrap_socket' when use ssl

Peter Otten __peter__ at web.de
Sat Apr 15 03:18:32 EDT 2017

Ho Yeung Lee wrote:

> Python 2.7.6 (default, Jun 22 2015, 18:00:18)
> [GCC 4.8.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import ssl
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/home/martin/Documents/ssl.py", line 13, in <module>
>     SSLError -- exception raised for I/O errors
> AttributeError: 'module' object has no attribute 'wrap_socket'

Look at the traceback again -- the ssl.py you are importing is not the one 
from the standard library, it's an arbitrary module, perhaps written by 
"martin". Once you rename Martin's ssl.py to something else and also remove 
the corresponding ssl.pyc you will be able to work with the desired ssl.py 
from the stdlib.

More information about the Python-list mailing list