Why does "import requests" fail in atom but not a console?

727 Views Asked by At

I have a basic python script that starts with

import requests
from bs4 import BeautifulSoup
from datetime import datetime
import difflib
import re

When I run that first block via Hydrogen (with ctrlenter), I get an attribute error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-686486c241c8> in <module>()
----> 1 import requests
/home/amanda/.local/lib/python2.7/site-packages/requests/__init__.py in <module>()
     51 # Attempt to enable urllib3's SNI support, if possible
     52 try:
---> 53     from .packages.urllib3.contrib import pyopenssl
     54     pyopenssl.inject_into_urllib3()
     55 except ImportError:
/home/amanda/.local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py in <module>()
     91 }
     92 
---> 93 DEFAULT_SSL_CIPHER_LIST = util.ssl_.DEFAULT_CIPHERS
     94 
     95 # OpenSSL will only write 16K at a time
AttributeError: 'module' object has no attribute 'DEFAULT_CIPHERS'AttributeError
'module' object has no attribute 'DEFAULT_CIPHERS'

But if I launch a python console, import requests works fine. What am I missing here?

0

There are 0 best solutions below