-1

I’m trying to complete the Page Spider Exercise linked in the last lesson of the Python for Everybody course, so I can better understand the learnings.

However, when I try to run the program (spider.py) it comes up with an error, like this:

users: $ python3 spider.py Enter web url or enter: [‘http://www.dr-chuck.com 57’] How many pages:5 1 h…dr-chuck.com Unable to retrieve or parse page No unretrieved HTML pages found

I’ve watched the exercise video and Dr Chuck says that if this error comes up it’s likely an issue with BeautifulSoup or something, but I have version 4 installed which is the latest version.

Does anyone have any ideas why this won’t run for me?

The file I’m using is spider.py located on the PY4E website: PY4E 99

Thanks!

So far, I've tried to troubleshoot this error by looking up if anyone else has come across this before. I tried to change 'from bs4 import BeautifulSoup' to 'from BeautifulSoup import *' and that didn't work either. Is there anyone who might have come across this before?

1 Answers1

0

This is because of the "AttributeError: module 'collections' has no attribute 'Callable'" error. Add the following line above the line where you import BeautifulSoup:

import collections
collections.Callable = collections.abc.Callable

You can read more about this error and how it can be fixed here: Error "AttributeError 'collections' has no attribute 'Callable' " using Beautiful Soup