Forums

AttributeError: 'NoneType' object has no attribute 'string' (BS4 and Amazon)

Hey,

I am trying to run a script using BeautifulSoup which scrapes Amazon product pricing. It works fine and without issue locally on Pycharm.

But within PythonAnywhere I am getting this error when run in bash console...

AttributeError: 'NoneType' object has no attribute 'string'

I did find some information on blocked sites for free users, but I am a paid user, so this shouldn't be a problem.

Any ideas what is causing this error?

Generally Amazon does not like to be scraped and since we use AWS for our infrastructure, they can block bots from PythonAnywhere. You may double check that by adding additional logging to your code check if its state is what you expect it to be.