dbr / tvdb_api

Simple to use interface to TheTVDB.com API in Python
The Unlicense
339 stars 63 forks source link

Occasional KeyError #64

Closed sbrudenell closed 4 years ago

sbrudenell commented 6 years ago

I'm using tvdb_api 2.0. I do a lot of by-name accesses, e.g. tvdb["Show Name"]. I occasionally get the following exception:

DEBUG tvdb_api tvdb_api.py:1162: Getting show Adventure Time)
DEBUG tvdb_api tvdb_api.py:942: Searching for show Adventure%20Time)
... loads some data ...
DEBUG tvdb_api tvdb_api.py:952: Found series Adventure Time)
DEBUG tvdb_api tvdb_api.py:970: Auto-selecting first search result using BaseUI)
DEBUG tvdb_api tvdb_api.py:1165: Got Adventure Time, id 152831)
... later ...
DEBUG tvdb_api tvdb_api.py:1159: Correcting Adventure Time to 152831
DEBUG tvdb_api tvdb_api.py:1183: Got series id 152831
DEBUG tvdb_api tvdb_api.py:1159: Correcting Brooklyn Nine-Nine to 269586
DEBUG tvdb_api tvdb_api.py:1183: Got series id 269586
... later ...
DEBUG tvdb_api tvdb_api.py:1159: Correcting Adventure Time to 152831
DEBUG tvdb_api tvdb_api.py:1183: Got series id 152831
Traceback (most recent call last):)
... files files files ...
  File "/home/me/venv/lib/python2.7/site-packages/tvdb_api.py", line 1184, in __getitem__)
    return self.shows[sid])
KeyError: 152831

It looks like the "smart" garbage collection in ShowContainer isn't all that smart.