Python – AttributeError: NoneType object has no attribute findAll

Python – AttributeError: NoneType object has no attribute findAll

You are ignoring any errors that could occur in urllib2.urlopen, if for some reason you are getting an error trying to get that page on your server, which you dont get testing locally you are effectively passing in an empty string () or a page you dont expect (such as a 404 page) to BeautifulSoup.

Which in turn makes your soup.find(table, id=datatable_main) return None since the document is something you dont expect.

You should either make sure you can get the page you are trying to get on your server, or handle exceptions properly.

There is no table with id datatable_main in the page that the script read.

Try printing the returned page to the terminal – perhaps your script is failing to contact the web server? Sometimes hosting services prevent outgoing HTTP connections.

Python – AttributeError: NoneType object has no attribute findAll

Leave a Reply

Your email address will not be published. Required fields are marked *