pygooglevoice parse_sms beautifulsoup error

333 views Asked by At

I am trying to run the pygooglevoice example script parse_sms.py to try and download the content of an sms with Python and am receiving the following error:

Traceback (most recent call last):
  File "C:\Python27\pygooglevoice-0.5-extras\examples\parse_sms.py", line 39, in <module>
    for msg in extractsms(voice.sms.html):
  File "C:\Python27\pygooglevoice-0.5-extras\examples\parse_sms.py", line 20, in extractsms
    tree = BeautifulSoup.BeautifulSoup(htmlsms)         # parse HTML into tree
AttributeError: type object 'BeautifulSoup' has no attribute 'BeautifulSoup'

I am running Windows 7 x64, Python 2.7

I have modified the parse_sms.py file only by changing the import of BeautifulSoup to 'from bs4 import BeautifulSoup'

I am new to Python and brand new to BeautifulSoup and I don't know what to do next to try and resolve this issue. Your help is appreciated.

1

There are 1 answers

1
sitiveni On BEST ANSWER

I had the same AttributeError when I was trying to use another tool (Wapiti). What helped me was to specifically use an older version of BeautifulSoup. By default, pip installs the latest version (currently 4.3.2). As soon as I installed the latest version 3 (3.2.1, dated February 16, 2012) it run without errors.

Here's what I did to install another version, using pip (on Mac OS X):

pip install beautifulsoup==3.2.1

Not sure though if that will help you, being on Windows.