Jul-04-2017, 12:49 AM
I have been working with this code from tut and picking the code apart. I got everything to work fine, the in the tut. they made a few changes. That is when the problem started. Thier are a few function I have never seen and the code is identical to the one in the tut. One thing I have never seen befor it the function re.compile. well anyway here is the code and the error.
Thank you
renny
import urllib2 from BeautifulSoup import BeautifulSoup import re opener = urllib2.build_opener() opener.addheaders = [('User-agent', 'Mozilla/5.0')] url = ('https://en.wikipedia.org/wiki/List_of_American_comedy_films') ourUrl = opener.open(url).read() soup = BeautifulSoup(ourUrl) for link in soup.findall('a', attrs = ('href', re.compile("^/wiki/^"))): print link #body = soup.find(text="Origin").findNext('td') #outfile = open('savestuff_2.txt', 'w') #outfile.write(body.text)Now the error
Traceback (most recent call last): File "C:/Users/renny/Desktop/python27/My_ webscraper/movie_scraper.py", line 15, in <module> for link in soup.findall('a', attrs = ('href', re.compile("^/wiki/^"))): TypeError: 'NoneType' object is not callableI am not sure what object can not be called, what is a nonetype object?
Thank you
renny
![Wall Wall](https://python-forum.io/images/smilies/eusa_wall.gif)