For some reason that I didn't fully investigate, I've recently had
movieParser.py throw an exception every time I call imdb.update()
The specific error I see from v4.1 is:
Traceback (most recent call last):
File "./test.py", line 5, in <module>
i.update(m)
File "/usr/lib/python2.6/site-packages/imdb/__init__.py", line 702, in
update
ret = method(mopID)
File "/usr/lib/python2.6/site-packages/imdb/parser/http/__init__.py", line
425, in get_movie_main
return self.mProxy.movie_parser.parse(cont, mdparse=self._mdparse)
File "/usr/lib/python2.6/site-packages/imdb/parser/http/utils.py", line
452, in parse
data = self.postprocess_data(data)
File "/usr/lib/python2.6/site-packages/imdb/parser/http/movieParser.py",
line 407, in postprocess_data
data['akas'] = data.get('other akas', []) + data.get('akas', [])
TypeError: coercing to Unicode: need string or buffer, list found
Where test.py is:
#!/usr/bin/env python
import imdb
i = imdb.IMDb()
m = i.search_movie('The Matrix')[0]
i.update(m)
print "Rating: %s" % m['rating']
I don't know why this is a problem now and it wasn't before... perhaps a
change in data format from imdb?
Being relatively new to python, I'm sure there's a better way to fix this,
but here's my hack:
--- movieParser.py- 2009-11-13 17:19:34.000000000 -0600
+++ movieParser.py 2009-11-13 17:20:47.000000000 -0600
@@ -404,7 +404,13 @@
obj.accessSystem = self._as
obj.modFunct = self._modFunct
if 'akas' in data or 'other akas' in data:
- data['akas'] = data.get('other akas', []) + data.get('akas',
[])
+ allakas = []
+ for x in data.get('akas', []):
+ allakas.append(x)
+ for x in data.get('other akas', []):
+ allakas.append(x)
+ data['akas'] = allakas
+ #data['akas'] = data.get('other akas', []) + data.get('akas',
[])
if 'other akas' in data:
del data['other akas']
if 'runtimes' in data:
which gets the job done (even if it's not the cleanest code).
My interest in imdbpy is its use in pyTivoMetaThis (which I didn't write,
but did maintain for a bit). Latest version here:
http://pytivo.sourceforge.net/forum/gmd-s-python-metadata-generator-t17-135.html#6356
Thanks to the imdbpy devs for writing this very useful module!
--
The Amigo
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel