'NoneType' object is not callable beautifulsoup error while using get_text

beautifulsoup, python, typeerror

Solution

The method is called `soup.getText()`, i.e. camelCased.

Why you get `TypeError` instead of `AttributeError` here is a mystery to me!

Problem

I wrote this code for extracting all text from a web page: ``` from BeautifulSoup import BeautifulSoup import urllib2 soup = BeautifulSoup(urllib2.urlopen('http://www.pythonforbeginners.com').read()) print(soup.get_text()) ``` The problem is I get this error: ``` print(soup.get_text()) TypeError: 'NoneType' object is not callable ``` Any idea about how to solve this?

Original source