Skip to content
Browse files

catch exception when weird xml is returned by imdbapi

  • Loading branch information...
1 parent aac47c0 commit 9b94aa8ec0dfdaf56ef2680e57ca00a7bd66ec06 @jlauwers jlauwers committed Apr 14, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 pchtrakt.py
View
6 pchtrakt.py
@@ -201,7 +201,11 @@ def doWork():
# quote(myMedia.parsedInfo.name),
# myMedia.parsedInfo.year))
oResponse = urlopen(ImdbAPIurl)
- oXml = ElementTree.XML(oResponse.read())
+ try:
+ oXml = ElementTree.XML(oResponse.read())
+ except sys.exc_type as e:
+ raise PchTraktException('Can\'t parse response: {0}'.format(ImdbAPIurl))
+
if oXml.find('movie') == None:
raise PchTraktException('Can\'t find the movie ID on: {0}'.format(ImdbAPIurl))
else:

0 comments on commit 9b94aa8

Please sign in to comment.
Something went wrong with that request. Please try again.