[Tutor] SSL Error

Peter Otten __peter__ at web.de
Tue Jul 31 13:28:39 EDT 2018


Saket Mehrotra wrote:

> Hi
> 
> I am trying to run import requests in a py file but I am getting below
> error  ssl.PROTOCOL_SSLv23: OpenSSL.SSL.SSLv23_METHOD,
> AttributeError: module 'ssl' has no attribute 'PROTOCOL_SSLv23'

If you start the Python interpreter and execute

>>> import ssl
>>> ssl.__file__
'/usr/lib/python3.4/ssl.py'

does it print something suspicious? You might be hiding the standard ssl.py 
with one you created yourself:

# touch ssl.py
$ python3
Python 3.4.3 (default, Nov 28 2017, 16:41:13) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> ssl.__file__
'/home/peter/mystuff/ssl.py'

In that case just rename the offending file (if you are using Python 2 
remember to remove the corresponding ssl.pyc).

>>>>
> 
> I tried to execute below from the terminal but it still remains
> unresolved.
> 
> sudo easy_install --upgrade pip
> 
> I've also had to run:
> 
> sudo pip uninstall pyopenssl
> 
> sudo pip install mozdownload
> 
> 
> Can you please help me .
> 
> Thanks & Regards
> Saket Mehrotra
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor




More information about the Tutor mailing list