Skip to content

Commit eac252f

Browse files
committed
remove import exceptions
1 parent 2eae542 commit eac252f

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

bioformats/formatreader.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import logging
3030
logger = logging.getLogger(__name__)
3131
import errno
32-
import exceptions
3332
import numpy as np
3433
import os
3534
import sys
@@ -582,11 +581,11 @@ def __init__(self, path=None, url=None, perform_init=True):
582581
logger.warn(line)
583582
if jutil.is_instance_of(
584583
je, "java/io/FileNotFoundException"):
585-
raise exceptions.IOError(
586-
errno.ENOENT,
584+
raise IOError(
585+
errno.ENOENT,
587586
"The file, \"%s\", does not exist." % path,
588587
path)
589-
e2 = exceptions.IOError(
588+
e2 = IOError(
590589
errno.EINVAL, "Could not load the file as an image (see log for details)", path.encode('utf-8'))
591590
raise e2
592591
else:
@@ -614,8 +613,8 @@ def __init__(self, path=None, url=None, perform_init=True):
614613
filename = os.path.split(path)[1]
615614

616615
if not os.path.isfile(self.path):
617-
raise exceptions.IOError(
618-
errno.ENOENT,
616+
raise IOError(
617+
errno.ENOENT,
619618
"The file, \"%s\", does not exist." % path,
620619
path)
621620

@@ -716,11 +715,11 @@ def init_reader(self):
716715
"()Ljava/lang/Throwable;")
717716
if jutil.is_instance_of(
718717
je, "java/io/FileNotFoundException"):
719-
raise exceptions.IOError(
720-
errno.ENOENT,
718+
raise IOError(
719+
errno.ENOENT,
721720
"The file, \"%s\", does not exist." % path,
722721
path)
723-
e2 = exceptions.IOError(
722+
e2 = IOError(
724723
errno.EINVAL, "Could not load the file as an image (see log for details)",
725724
self.path.encode('utf-8'))
726725
raise e2

bioformats/tests/test_load_using_bioformats.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from __future__ import absolute_import, print_function, unicode_literals
99

10-
import exceptions
1110
import os
1211
import unittest
1312

@@ -37,8 +36,7 @@ def test_load_using_bioformats(self):
3736
def test_file_not_found(self):
3837
# Regression test of issue #6
3938
path = os.path.join(os.path.dirname(__file__), 'Channel5-01-A-01.tif')
40-
self.assertRaises(exceptions.IOError,
41-
lambda :load_image(path))
39+
self.assertRaises(IOError, lambda :load_image(path))
4240

4341
class TestLoadUsingBioformatsURL(unittest.TestCase):
4442
def setUp(self):

0 commit comments

Comments
 (0)