From 0f3ad34af2b699a4b4664025799bffe644d40765 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 23 Jun 2009 01:49:11 +0900 Subject: [PATCH] make update check more fault tolerant --- ankiqt/ui/update.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ankiqt/ui/update.py b/ankiqt/ui/update.py index f85867649..0235e7245 100644 --- a/ankiqt/ui/update.py +++ b/ankiqt/ui/update.py @@ -50,12 +50,13 @@ class LatestVersionFinder(QThread): d = urllib.urlencode(d) try: f = urllib2.urlopen(baseUrl + "getQtVersion", d) - except (urllib2.URLError, httplib.BadStatusLine): + resp = f.read() + if not resp: + return + resp = simplejson.loads(resp) + except: + # behind proxy, corrupt message, etc return - resp = f.read() - if not resp: - return - resp = simplejson.loads(resp) if resp['latestVersion'] > ankiqt.appVersion: self.emit(SIGNAL("newVerAvail"), resp) diff = resp['currentTime'] - time.time()