Why do I have so many warnings and errors when using IMDbPY?

I am using IMDbPY to retrieve data from IMDb. I get the correct results, and everything looks fine, except for one thing: no matter what I do, I get warnings. The results are accurate, but they only appear after a long list of warnings and sometimes errors.

For example: The following code should print Resevior Dogs (1992) :

import imdb db = imdb.IMDb() movie_obj = db.search_movie('pulp fiction')[0] db.update(movie_obj) print movie_obj['long imdb canonical title'] 

He does this, but not until the following warnings and errors:

 2011-03-18 00:33:11,490 WARNING [imdbpy.parser.http.domparser] C:\Python27\lib\site-packages\imdb\parser\http\utils.py:459: unable to use "lxml": No module named lxml.html 2011-03-18 00:33:11,507 WARNING [imdbpy.parser.http.domparser] C:\Python27\lib\site-packages\imdb\parser\http\utils.py:450: falling back to "beautifulsoup" 2011-03-18 00:33:13,483 WARNING [imdbpy.parser.http.domparser] C:\Python27\lib\site-packages\imdb\parser\http\utils.py:459: unable to use "lxml": No module named lxml.html 2011-03-18 00:33:13,483 WARNING [imdbpy.parser.http.domparser] C:\Python27\lib\site-packages\imdb\parser\http\utils.py:450: falling back to "beautifulsoup" 2011-03-18 00:33:15,137 ERROR [imdbpy.parser.http.domparser] C:\Python27\lib\site-packages\imdb\parser\http\utils.py:566: DOMHTMLMovieParser: caught exception extracting XPath "//div[@id='tn15title']//span[starts-with(text(), 'TV series')]" Traceback (most recent call last): File "C:\Python27\lib\site-packages\imdb\parser\http\utils.py", line 555, in xpath xpath_result = element.xpath(path) File "C:\Python27\lib\site-packages\imdb\parser\http\bsouplxml\etree.py", line 57, in xpath return path.apply(node) File "C:\Python27\lib\site-packages\imdb\parser\http\bsouplxml\bsoupxpath.py", line 113, in apply nodes = step.apply(nodes) File "C:\Python27\lib\site-packages\imdb\parser\http\bsouplxml\bsoupxpath.py", line 287, in apply found = filter(checker, found) File "C:\Python27\lib\site-packages\imdb\parser\http\bsouplxml\bsoupxpath.py", line 331, in __call__ return self.__filter(node) File "C:\Python27\lib\site-packages\imdb\parser\http\bsouplxml\bsoupxpath.py", line 360, in __starts_with first = node.contents[0] IndexError: list index out of range 2011-03-18 00:33:16,785 WARNING [imdbpy.parser.http.domparser] C:\Python27\lib\site-packages\imdb\parser\http\utils.py:459: unable to use "lxml": No module named lxml.html 2011-03-18 00:33:16,785 WARNING [imdbpy.parser.http.domparser] C:\Python27\lib\site-packages\imdb\parser\http\utils.py:450: falling back to "beautifulsoup" 2011-03-18 00:33:16,849 WARNING [imdbpy.parser.http.domparser] C:\Python27\lib\site-packages\imdb\parser\http\utils.py:459: unable to use "lxml": No module named lxml.html 2011-03-18 00:33:16,849 WARNING [imdbpy.parser.http.domparser] C:\Python27\lib\site-packages\imdb\parser\http\utils.py:450: falling back to "beautifulsoup" 

Why am I getting this? Am I doing something wrong?

+4
source share
1 answer

Well, this is pretty clear:

cannot use "lxml": no module named lxml.html

Can you do this to check if a module exists?

  • In a terminal or command line, start python .
  • Print the output of the first line (e.g. Python 2.6.6 (r266... ).
  • In the shell, enter import lxml .
  • Then try import lxml.html .

For me this happens:

 blender@desktop :~$ python Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import lxml >>> import lxml.html >>> 

I have a module installed, so I do not get any output (it was successfully imported).

+2
source

Source: https://habr.com/ru/post/1344203/


All Articles