I'm following the exercises on the book 'Web Scraping with Python' but I get an 'unexpected EOF while parsing' error when running the following code:
from urllib.request import urlopen
from urllib.error import HTTPError
try:
html = urlopen('http://www.pythonscraping.com/pages/page1.html')
except HTTPError as e:
print(e)
# return null, break, or do some other "Plan B"
else:
# program continues. Note: If you return or break in the
# exception catch, you do not need to use the "else" statement
Any clues regarding what might be causing it?
Thanks in advance.