1

Not quite understanding why I am getting this trace error:

Traceback (most recent call last):
  File "S:/Personal Folders/Andy/Python Projects/Salesforce BZ API/Automated Reports.py", line 15, in <module>
    parse = br.soup("find('div')")
  File "build\bdist.win32\egg\spynner\browser.py", line 409, in _get_soup
    return self._html_parser(self.html)
TypeError: 'str' object is not callable

Here is my code:

from __future__ import division
#from __future__ import unicode_literals
from __future__ import print_function
import spynner
from BeautifulSoup import BeautifulSoup

#Loading up Salesforce

br = spynner.Browser()
#br.debug_level = spynner.DEBUG
br.create_webview()
br.show()
br.set_html_parser("BeautifulSoup")
br.load("https://login.salesforce.com/")
parse = br.soup("find('div')")
print(parse)
br.browse()
br.close()
Steven Matthews
  • 9,705
  • 45
  • 126
  • 232

2 Answers2

5

It looks like you're setting the HTML parser to the string "BeautifulSoup", not to BeautifulSoup. I don't have it installed so I can't test whether it works, but it's worth a try.

DSM
  • 342,061
  • 65
  • 592
  • 494
  • Thanks, this appears to be it! Wow, I feel like such an idiot! – Steven Matthews Aug 08 '11 at 21:17
  • No idiocy involved, only inexperience. :^) If you can see now what the error message is trying to tell you, then you've won more than you lost in time. – DSM Aug 08 '11 at 21:25
0

I took a quick look here, and it seems that soup is not a function but a property.

Ken Wayne VanderLinde
  • 18,915
  • 3
  • 47
  • 72