urllinks.py sample code needs an import update to run beautifulsoup
nratzan opened this issue · 4 comments
Hi Dr. Chuck,
I love the py4e courses! Thank you.
The urllinks.py sample code needs updating so beautiful soup works with newer versions of python, e.g. 3.10.
I'm getting an error saying the module collections isn't callable.
I found a solution on stackoverflow:
The urllinks.py file should have this included:
import collections
collections.Callable = collections.abc.Callable
Thank you for making so many great, free resources!
Noah
Thanks Noah - this summer I will be going through these issues and fixing the course content.
Hi Noah,
The version in https://www.py4e.com/code3/urllinks.py is working fine it seems. I have checked it both on Replit and Google Colab as well
Noah,
That is a sort of fudge workaround, in several searches. Yes, it's likely an issue on www.py4e.com. A message is needed, while in the version on Coursera PY4E the TA's have a pinned post. Which is, Python 3.10 remove the bs4 folder when using the code3.zip & pip install beautifulsoup4.
For earlier versions of Python keep the bs4 folder, don't install beautifulsoup4
Updating the bs4.zip would also work, and the extra instructions could possibly be removed. Following the Python end-of-life dates.
I have update the bs4.zip folder to latest python and included dependencies - so it should work without change to the documentation. Which is nice.