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.

(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.

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.

(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.

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.