mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-10 14:59:17 +08:00
corrected syntax for error handling while fetching image from
a URL in class Picture
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user