Errors using Beautiful Soup 4
#1
I'm having a lot of problems using Beautiful Soup 4 on a new addon. The scraping code works fine locally under a unit test, but fails with multiple exceptions when installed as an add on. The errors I'm getting are:

Code:
Exception
20:07:45 T:139805044225792   ERROR: TypeError
20:07:45 T:139805044225792   ERROR: :
20:07:45 T:139805044225792   ERROR: "'NoneType' object is not callable"
20:07:45 T:139805044225792   ERROR:  in
20:07:45 T:139805044225792   ERROR: 'lxml.etree._ExceptionContext._store_raised'
20:07:45 T:139805044225792   ERROR:  ignored
20:07:45 T:139805044225792   ERROR: Exception
20:07:45 T:139805044225792   ERROR: TypeError

My addon is located at https://github.com/planetmarshall/bmctv_addon. See the file 'bmctv.py' for the scraping code, and the 'test' folder for a harness.

I'm expecting to see a list of about a dozen videos from the scraper, and indeed that's what I get when I run locally. However installing the addon and viewing the log file it only extracts a single video from the same source.

Any help appreciated.

Cheers,
Andrew.
Reply
#2
Have reverted to BeautifulSoup 3.2.1 and it works as expected. Some issue with the xbmc python environment, maybe?
Reply
#3
I wonder if something is going wrong with the logic that bs4 uses to select a parser, as it seems to be trying to use lxml?

Maybe try specifying the built-in parser with
Code:
bs = bs4.BeautifulSoup(text, "html.parser")
Leopold's Repository: Home of LibreELEC Dev Updater ...
Reply
#4
Thank you so much! Specifying the parser fixed it for me.
Reply
#5
Have just ugraded to Helix, and am now getting the following error,

Code:
21:09:55 T:140195844056832   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.ImportError'>
                                            Error Contents: No module named bs4
                                            Traceback (most recent call last):
                                              File "/home/xbmc/.kodi/addons/plugin.video.bmctv/bmctv_main.py", line 6, in <module>
                                                import bmctv
                                              File "/home/xbmc/.kodi/addons/plugin.video.bmctv/bmctv.py", line 1, in <module>
                                                from bs4 import BeautifulSoup
                                            ImportError: No module named bs4
                                            -->End of Python script error report<--
21:09:55 T:140195844056832    INFO: Python script stopped

Beautiful Soup 4 is installed as far as I can tell, and is specified in addon.xml as follows

Code:
<import addon="script.module.beautifulsoup4" version="4.3.2"/>

Any help appreciated.
Reply
#6
(2015-01-20, 23:16)planetmarshall Wrote: Have just ugraded to Helix, and am now getting the following error,

please post a complete Debug Log.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#7
Seems to be working now after a restart. Thanks.
Reply

Logout Mark Read Team Forum Stats Members Help
Errors using Beautiful Soup 40