![]() |
Traceback error - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Traceback error (/thread-12512.html) |
Traceback error - tjnichols - Aug-28-2018 Good morning / afternoon. I am working on a activity where I am supposed to get siblings from a teaching website. I am getting a traceback error and I don't understand it. I have tried everything I can think of. Here is the code I'm trying to run. Notice at the top - I have 4 rows rather than the two my activity shows. Yesterday, I learned that using this will help with dealing with errors so I've chosen to use these in all the code I create. The two rows my activity calls for is "import urlopen" and "from bs4 import BeautifulSoup". I have tried removing my additions but it didn't resolve the error. from urllib.request import urlopen from urllib.error import HTTPError from urllib.error import URLError from bs4 import BeautifulSoup html = urlopen('http://www.pythonscraping.com/pages/page3.html') bs = BeautifulSoup(html, 'html.parser') for sibling in bs.find('table', {'id':'giftList'}).tr.nest_siblings: print(sibling)This is the error I get. I will most appreciate any help you provide!
RE: Traceback error - Vysero - Aug-28-2018 Well without diving to deeply I would start by trying to figure out which variable is of type None. Essentially, the error is telling you that there is a variable that you are attempting to iterate that is of type None on line 9. RE: Traceback error - buran - Aug-28-2018 it is next_siblings I think at the moment it looks for a tag nest_siblings
RE: Traceback error - tjnichols - Sep-05-2018 buran - that was it exactly! I need to look closer at what I'm typing! Thank you! |