galileo228 <mattbar...@gmail.com> writes: > Using BeautifulSoup, mechanize, and urllib, I've constructed the > following: > > br.open("http://www.school.edu/students/facebook/") > br.select_form(nr = 1) > > br.form['fulltextsearch'] = 'msb83' # this searches the facebook for > me > br.submit() > results = br.response().read() > soup = BeautifulSoup(results) > foo2 = soup.find('td', attrs={'width':'95'}) > foo3 = foo2.find('a') > foo4 = foo3.find('img', attrs={'src':'deliverImage.cfm?netid=msb83'}) > # this just drills down to the <img> line and until this point the > program does not return an error > > save_as = os.path.join('./', msb83 + '.jpg') > urllib.urlretrieve(foo4, save_as) > > I get the following error msg after running this code: > > AttributeError: 'NoneType' object has no attribute 'strip'
Wild guess, since you didn't provide line numbers, etc. foo4 is None (I also would like to suggest to use more meaningful names) -- John Bokma j3b Hacking & Hiking in Mexico - http://johnbokma.com/ http://castleamber.com/ - Perl & Python Development -- http://mail.python.org/mailman/listinfo/python-list