Thanks a lot for your Help!
But I think I have finally found the real problem :) :
I get my episode movie objects by using movie["episodes"] which
gives me a directory of seasons and each season has a list of episodes.
To illustrate my example look at and you'll see the error right away:
from imdb import IMDb
ia = IMDb('http')
sp = ia.get_movie('0121955')
seasons = sp['episodes']
randomepisode = seasons
print randomepisode.get("plot") #works
print randomepisode.get("rating") #prints None
Note that I actually could call ia.update(randomepisode) and the
rating would appear but it's extremly slow.
Thanks for all of your help! I really LOVE imdbpy so far :)
2010/5/28 Davide Alberani <da@...>:
> On May 28, David Kaufman <david.kaufman@...> wrote:
>> Well, that's what I tried from the beginning, but it didn't work:
>> from imdb import IMDb
>> ia = IMDb('http')
>> sp = ia.get_movie('01635619')
>> print sp.summary()
>> ia.update(sp, 'rating')
>> print sp.get('rating')
> There is an unrequired line: :-)
> ia.update(sp, 'rating')
> The 'info sets' are not a 1-to-1 map to keys: sometimes they
> contain a huge number of keys, and this is the case of the
> 'main' info set (fetched by default along with the 'plot' one,
> for movies).
> Retrieving information from the web, you have to think at
> an 'info set' as a single web page (and in fact it is): it can
> contain one information or many.
> In your case, the 'rating' key is contained in the 'main' info set.
> The whole system probably suffers of two big problems:
> 1. 'info set', as a name, is not enough meaningful,
> 2. there's in fact no way to tell which keys will be added by a
> given 'info set' (and, by the way, the fetched web page can
> also contain no information at all).
> We keep maps of 'info set' -> ['keys'] and 'key' -> 'info set'
> after an 'info set' is retrieved, but we can't do it before.
> They are in the "infoset2keys" and "key2infoset" attribute of
> a Movie/Person/Character/Company instance.
> Anyway, I'll probably make the 'update' method more robust:
> there's no reason to raise an exception: it's enough to notify
> the problem (an unknown info set) an keep going.
> The fix is already in the repository.
> Thanks for the idea, I'll add your name to the credits. :-)
> Davide Alberani <da@...> [GPG KeyID: 0x465BFD47]