jmcarp / robobrowser

BSD 3-Clause "New" or "Revised" License
3.7k stars 337 forks source link

Errors Running the example script from the documentation #68

Open frmsaul opened 8 years ago

frmsaul commented 8 years ago

Hi,

Im trying to run the first script found here: http://robobrowser.readthedocs.io/en/latest/readme.html (The one that scrapes Genius.com)

And I'm getting the following error + warning:

/Users/saulfuhrmann/Computers/VirtualEnviroments/TinderHack/lib/python2.7/site-packages/bs4/__init__.py:181: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

The code that caused this warning is on line 9 of the file test_robo.py. To get rid of this warning, change code that looks like this:

 BeautifulSoup([your markup])

to this:

 BeautifulSoup([your markup], "html.parser")

  markup_type=markup_type))
Traceback (most recent call last):
  File "test_robo.py", line 11, in <module>
    form['q'].value = 'queen'
TypeError: 'NoneType' object has no attribute '__getitem__'

Im using Python 2.7.10 and my OS is OS X El Capitan (10.11.4)

Am I doing something wrong? Or did Genius.com just changed their interface and the script is not updated?

-- Saul

d7laungani commented 7 years ago

I am having the same issue. I don't think it is an issue specifically with genius.com because I am encountering it with other websites too.

ghost commented 7 years ago

You can pass the parser to beautifulsoup like this: browser = RoboBrowser(parser='html5lib')