From dc85186e19b89cca994eef0e452da263d9365f37 Mon Sep 17 00:00:00 2001 From: Neeraj Gangwar Date: Wed, 12 Mar 2014 13:05:53 +0530 Subject: [PATCH] corrected syntax for error handling while fetching image from a URL in class Picture --- skimage/novice/_novice.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/skimage/novice/_novice.py b/skimage/novice/_novice.py index 4cbc35ed..0b63fcca 100644 --- a/skimage/novice/_novice.py +++ b/skimage/novice/_novice.py @@ -230,12 +230,12 @@ class Picture(object): self.array = img_as_ubyte(io.imread(BytesIO(data))) self._format = imghdr.what("", h=data) self._path = path - except error.HTTPError, e: - print 'HTTP Error ', e.code - except error.URLError, e: - print 'URL Error\n', e.args + except error.HTTPError as err: + print('HTTP Error: {0}'.format(err)) + except error.URLError as err: + print('URL Error: {0}'.format(err)) except error.ContentTooShortError: - print 'Content too short' + print('Content too short') else: path = os.path.abspath(path) self.array = img_as_ubyte(io.imread(path))