From: Oleg Broytman Date: Sun, 10 Feb 2008 21:49:40 +0000 (+0000) Subject: fp could be None in http_error_default(). X-Git-Tag: v4.5.3~213 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=9c02fd12dc95900aa8968f46fb46f47e291369d3;p=bookmarks_db.git fp could be None in http_error_default(). git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@163 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- diff --git a/Robots/bkmk_rsimple.py b/Robots/bkmk_rsimple.py index 6f65b22..2d5ec8f 100644 --- a/Robots/bkmk_rsimple.py +++ b/Robots/bkmk_rsimple.py @@ -45,6 +45,12 @@ class MyURLopener(urllib.URLopener): def http_error_401(self, url, fp, errcode, errmsg, headers, data=None): raise IOError, ('http error', errcode, "Authentication required ", headers) + def http_error_default(self, url, fp, errcode, errmsg, headers): + if fp: + void = fp.read() + fp.close() + raise IOError, ('http error', errcode, errmsg, headers) + urllib._urlopener = MyURLopener()