pikkuu
pikkuu

Reputation: 71

NoneType object is not callable__ beautiful soup

This is my code so far

# -*- encoding: utf-8 -*-

import urllib2
from BeautifulSoup import BeautifulSoup as bs
import json


data = urllib2.urlopen('http://www.jma.go.jp/en/yoho/320.html')

html_doc = data.read()

soup = bs(html_doc)

weather = soup.find('table',attrs={'class':'forecast'})
weather_res = weather.find_all('th')

Why I get NoneType error for this...

Upvotes: 3

Views: 1635

Answers (1)

Guillaume
Guillaume

Reputation: 10961

It seems you're confusing Beautiful Soup 3 and 4, you're importing the version 3, but using find_all, a function of version 4. This function was findAll in version 3. So if you want to keep using version 3, you need to rewrite it to:

weather_res = weather.findAll('th')

Upvotes: 5

Related Questions