From 325826e214982bae30b86912628897ec9a8af0c7 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Mon, 12 Jul 2010 19:01:31 +0000 Subject: [PATCH] Under some conditions urlerror doesn't have a code, so just report the raw error message in that case --- htsworkflow/util/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htsworkflow/util/api.py b/htsworkflow/util/api.py index b5e2492..316aa49 100644 --- a/htsworkflow/util/api.py +++ b/htsworkflow/util/api.py @@ -83,11 +83,11 @@ def retrieve_info(url, apidata): apipayload = urllib.urlencode(apidata) web = urllib2.urlopen(url, apipayload) except urllib2.URLError, e: - if e.code == 404: + if hasattr(e, 'code') and e.code == 404: logging.info("%s was not found" % (url,)) return None else: - errmsg = 'URLError: %d %s' % (e.code, e.msg) + errmsg = 'URLError: %s' % (str(e)) raise IOError(errmsg) contents = web.read() -- 2.30.2