"script.watchlist failed" on every entry to home screen

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
lkraav Offline
Member
Posts: 88
Joined: Jul 2009
Reputation: 0
Post: #1
I'm seeing this in logs:

Code:
20:14:53 T:2844781424    INFO: -->Python script returned the following error<--
20:14:53 T:2844781424   ERROR: Error Type: <type 'exceptions.KeyError'>
20:14:53 T:2844781424   ERROR: Error Contents: ('fanart',)
20:14:53 T:2844781424   ERROR: Traceback (most recent call last):
                                              File "/secure/home/media/.xbmc/addons/script.watchlist/default.py", line 588, in <module>
                                                Main()
                                              File "/secure/home/media/.xbmc/addons/script.watchlist/default.py", line 33, in __init__
                                                self._fetch_info()
                                              File "/secure/home/media/.xbmc/addons/script.watchlist/default.py", line 58, in _fetch_info
                                                self._fetch_tvshows()
                                              File "/secure/home/media/.xbmc/addons/script.watchlist/default.py", line 127, in _fetch_tvshows
                                                item = [tvshow['tvshowid'], tvshow['thumbnail'], tvshow['studio'], tvshow['label'], tvshow['fanart'], []]
                                            KeyError: ('fanart',)
20:14:53 T:2844781424    INFO: -->End of Python script error report<--

Running xbmc-pvr-odk68 build from 14 days ago. Who is the culprit here, Xeebo or watchlist?

xbmc-pvr-ppa-odk68, Gentoo x86 3.0.7-pf, xorg-server-1.11.2, mesa-7.11, nvidia-drivers-290.10
find quote
Martijn Offline
Team Kodi
Posts: 11,218
Joined: Jul 2011
Reputation: 162
Location: Dawn of time
Post: #2
Wacthlist.

Can you check what version of watchlists you have and post here including full Debug Log

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2012-03-13 11:00 by Martijn.)
find quote
petpetpet Offline
Junior Member
Posts: 3
Joined: May 2012
Reputation: 0
Post: #3
Code:
def _fetch_tvshows( self ):
        self.tvshows = []
        # fetch all episodes in one query
        json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"properties": ["title", "playcount", "plot", "season", "episode", "showtitle", "thumbnail", "file", "lastplayed", "rating"], "sort": {"method": "episode"} }, "id": 1}' )
        json_query = unicode(json_query, 'utf-8', errors='ignore')
        json_response = simplejson.loads(json_query)
        if json_response['result'].has_key('episodes'):
            json_response = json_response['result']['episodes']
            # our list is sorted by episode number, secondary we sort by tvshow title (itertools.groupy needs contiguous items) and split it into seperate lists for each tvshow
            [b]episodes = [list(group) for key,group in itertools.groupby(sorted(json_response, key=itemgetter('showtitle')), key=itemgetter('showtitle'))][/b]
        # fetch all tvshows, sorted by title
        json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": {"properties": ["title", "studio", "thumbnail", "fanart"], "sort": {"method": "title"}}, "id": 1}')
        json_query = unicode(json_query, 'utf-8', errors='ignore')
        json_response = simplejson.loads(json_query)
        if json_response['result'].has_key('tvshows'):
            for count, tvshow in enumerate(json_response['result']['tvshows']):
                item = [tvshow['tvshowid'], tvshow['thumbnail'], tvshow['studio'], tvshow['title'], tvshow['fanart'], []]
                [b]for episodelist in episodes:[/b]
                    if episodelist[0]['showtitle'] == item[3]:
                        item[5] = episodelist
                        break
                self.tvshows.append(item)
        log("tv show list: %s items" % len(self.tvshows))

The 'episodes' variable is only created inside the
if json_response['result'].has_key('episodes'):
binding, while it's being referenced in the for loop later on in the function.

Im not terribly familiar with python's variable binding scope, but I am quite sure that if the JSON response doesn't have a key called 'episodes' then this function is going to break when it gets to the for loop.

This can be syntactically fixed by simply putting
episodes = []
near the top of the function, however I'm not sure if that's a valid use case.
find quote
Martijn Offline
Team Kodi
Posts: 11,218
Joined: Jul 2011
Reputation: 162
Location: Dawn of time
Post: #4
and if your JSON request doesn't have any episodes that means your library is empty.

On the other hand it shouldn't create any failure so perhaps best to catch those errors.
Never had any problem with this so far

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find quote
petpetpet Offline
Junior Member
Posts: 3
Joined: May 2012
Reputation: 0
Post: #5
right, so it probably wasn't tested against a fresh install with an empty TV Show library.
find quote
Martijn Offline
Team Kodi
Posts: 11,218
Joined: Jul 2011
Reputation: 162
Location: Dawn of time
Post: #6
(2012-05-13 12:32)petpetpet Wrote:  right, so it probably wasn't tested against a fresh install with an empty TV Show library.

Nope Big Grin
Will get that looked at.

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2012-05-13 13:04 by Martijn.)
find quote
ronie Online
Team-Kodi Member
Posts: 9,153
Joined: Jan 2009
Reputation: 157
Post: #7
(2012-05-13 11:48)petpetpet Wrote:  The 'episodes' variable is only created inside the
if json_response['result'].has_key('episodes'):
binding, while it's being referenced in the for loop later on in the function.

cheer mate, i'll fix that right away :-)

though technically speaking, if you don't have any episodes, you won't have any tv shows either,
so you'll never get to the for loop, i think?

either way, it won't hurt to define an empty episodes list at the start.

Always read the Kodi online-manual, FAQ and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
petpetpet Offline
Junior Member
Posts: 3
Joined: May 2012
Reputation: 0
Post: #8
Not sure. I got the error when I upgraded from 11.0 stable to the latest nightly this morning. There appears to either be something wrong with that nightly, or something wrong with the way I upgraded because it seems to be unable to query my episodes from the DB (so my tv shows show up as empty) even though it can clearly find the files and downloads the artwork etc for them. Therefore, I didn't really have an empty fresh install. So it may well be the case that this function doesn't get called at all with an empty library, but it looks to me like it would.

Regardless, it's usually a bad idea™ to put the first declaration of a variable inside a conditional binding if it being used outside of that binding.
(This post was last modified: 2012-05-13 14:50 by petpetpet.)
find quote
Chris! Offline
Donor
Posts: 1,012
Joined: Apr 2010
Reputation: 16
Location: England
Post: #9
Sorry to thread resurrect but i'm having trouble since upgrading to openelec 2.0
I'm using the latest xeebo in hitcher's repository and get the "watchlist.script" failed.

I'm sure it's something simple that i've done but I can't figure it out, can someone help?

debug log: http://pastebin.com/vZ8BEgra

Thanks
Chris!


Flirc now has a forum: forum.flirc.tv
find quote
Martijn Offline
Team Kodi
Posts: 11,218
Joined: Jul 2011
Reputation: 162
Location: Dawn of time
Post: #10
(2012-10-22 21:29)Chris! Wrote:  Sorry to thread resurrect but i'm having trouble since upgrading to openelec 2.0
I'm using the latest xeebo in hitcher's repository and get the "watchlist.script" failed.

I'm sure it's something simple that i've done but I can't figure it out, can someone help?

debug log: http://pastebin.com/vZ8BEgra

Thanks
Chris!

That's because you couldn't read.

You installed 12.0.1 which isn't for Eden *which was clearly stated)
Remove the script from the Addons folder and install the correct one
http://mirrors.xbmc.org/addons/eden/script.watchlist/

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2012-10-22 21:32 by Martijn.)
find quote
Chris! Offline
Donor
Posts: 1,012
Joined: Apr 2010
Reputation: 16
Location: England
Post: #11
Sorry, when I re-installed xeebo from the repo watchlist didn't work.
Then I couldn't find the new watch list script (probably more stupidity on my part) so I used the one I had from before - then forgot where I got that from.

All makes sense now, thanks for pointing me to the right script.
I don't always do the cleverest of things.


Flirc now has a forum: forum.flirc.tv
find quote