On May 28, David Kaufman <david.kauf...@gmx.de> 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 <d...@mimante.net> [GPG KeyID: 0x465BFD47] http://www.mimante.net/ ------------------------------------------------------------------------------ _______________________________________________ Imdbpy-devel mailing list Imdbpy-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-devel