From 9c02fd12dc95900aa8968f46fb46f47e291369d3 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 10 Feb 2008 21:49:40 +0000 Subject: [PATCH] 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 --- Robots/bkmk_rsimple.py | 6 ++++++ 1 file changed, 6 insertions(+) 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() -- 2.39.5