home · contact · privacy
Handle UnicodeDecodeError.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 18 Jan 2016 01:43:46 +0000 (02:43 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 18 Jan 2016 01:43:46 +0000 (02:43 +0100)
plomlombot.py

index 4ec66463566a8205a6d89e7c9baa0a85569742d5..7d0f5355a1f70eb1cc946249d1d5e76154b33b49 100755 (executable)
@@ -109,7 +109,8 @@ def lineparser_loop(io, nickname):
                 try:
                     webpage = urllib.request.urlopen(request, timeout=15)
                 except (urllib.error.HTTPError, urllib.error.URLError,
                 try:
                     webpage = urllib.request.urlopen(request, timeout=15)
                 except (urllib.error.HTTPError, urllib.error.URLError,
-                        UnicodeError, http.client.BadStatusLine) as error:
+                        UnicodeError, http.client.BadStatusLine,
+                        UnicodeDecodeError) as error:
                     print("TROUBLE FOLLOWING URL: " + str(error))
                     continue
                 charset = webpage.info().get_content_charset()
                     print("TROUBLE FOLLOWING URL: " + str(error))
                     continue
                 charset = webpage.info().get_content_charset()