Python Scraping Data From the Web Introducing Data Scraping Beautiful Soup

Jason Anders
Jason Anders
Treehouse Moderator 144,848 Points

[SOLVED] Any ideas on why I'm getting this error and failure to compile?

Well, only the third video... and I broke it. :(

Any ideas?

/Users/ja/PycharmProjects/web_scraping/venv/bin/python /Users/ja/PycharmProjects/web_scraping/
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/", line 1240, in do_open
    h.request(req.get_method(), req.selector,, headers)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/", line 1083, in request
    self._send_request(method, url, body, headers)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/", line 1128, in _send_request
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/", line 1079, in endheaders
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/", line 911, in _send_output
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/", line 854, in send
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/", line 1237, in connect
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/", line 376, in wrap_socket
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/", line 747, in __init__
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/", line 983, in do_handshake
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/", line 628, in do_handshake
ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ja/PycharmProjects/web_scraping/", line 4, in <module>
    html = urlopen('')
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/", line 162, in urlopen
    return, data, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/", line 465, in open
    response = self._open(req, data)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/", line 483, in _open
    '_open', req)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/", line 443, in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/", line 1283, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/", line 1242, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645)>

Process finished with exit code 1

I'm still relatively new to Python and PyCharm, so I'm kind of at a loss now for troubleshooting.

Thanks in advance! :dizzy:

5 Answers

Jason Anders
Jason Anders
Treehouse Moderator 144,848 Points


After banging my head against the wall a few times, I finally noticed that PyCharm interpreter was, for reasons I'm not sure, using Python 3.5.1. This version will throw that error because of the deprecated use by Apple of OpenSSL.
This is, however, now included in the latest version of Python (3.7) and is why the code runs once this was changed.
I am running on a Mac

Once I went to the Applications and found the Python 3.7 folder, I just double-clicked the Update Shell Command file and like magic, everything now seems to work just like Ken's :smile:

I need a Tylenol now! Lol

Hope this helps someone else down the road! :) :dizzy:

olu adesina
olu adesina
Pro Student 19,018 Points

I don't know where I am going, I cannot find the Update Shell Command - I am currently using a Mac - could you explain where you went exactly?

Jason Anders
Jason Anders
Treehouse Moderator 144,848 Points

olu adesina

Once you download Python 3.7, there should be a "Python 3.7" folder in your Root Application folder in Finder. Inside that folder there is the Update Shell Command command file that you just double click on.


Ross Coe
Ross Coe
5,061 Points

I had this but changed the projects interpretor to be the system one (maybe there was python3 and update command in venv?)

Mischa Yartsev
Mischa Yartsev
20,491 Points

Nice man, that link really helped

Mirza Gogic
Mirza Gogic
2,736 Points

On your Mac, if you're using it, go to Applications, Python 3.7 and then double-click "Install Certificates.command". That should do it.

P.S. Don't forget to install a parser. For some reason, hmtl-parser didn't work for me, so I used "lxml" instead. Worked like a charm.