|
29 | 29 | import logging |
30 | 30 | logger = logging.getLogger(__name__) |
31 | 31 | import errno |
32 | | -import exceptions |
33 | 32 | import numpy as np |
34 | 33 | import os |
35 | 34 | import sys |
@@ -582,11 +581,11 @@ def __init__(self, path=None, url=None, perform_init=True): |
582 | 581 | logger.warn(line) |
583 | 582 | if jutil.is_instance_of( |
584 | 583 | je, "java/io/FileNotFoundException"): |
585 | | - raise exceptions.IOError( |
586 | | - errno.ENOENT, |
| 584 | + raise IOError( |
| 585 | + errno.ENOENT, |
587 | 586 | "The file, \"%s\", does not exist." % path, |
588 | 587 | path) |
589 | | - e2 = exceptions.IOError( |
| 588 | + e2 = IOError( |
590 | 589 | errno.EINVAL, "Could not load the file as an image (see log for details)", path.encode('utf-8')) |
591 | 590 | raise e2 |
592 | 591 | else: |
@@ -614,8 +613,8 @@ def __init__(self, path=None, url=None, perform_init=True): |
614 | 613 | filename = os.path.split(path)[1] |
615 | 614 |
|
616 | 615 | if not os.path.isfile(self.path): |
617 | | - raise exceptions.IOError( |
618 | | - errno.ENOENT, |
| 616 | + raise IOError( |
| 617 | + errno.ENOENT, |
619 | 618 | "The file, \"%s\", does not exist." % path, |
620 | 619 | path) |
621 | 620 |
|
@@ -716,11 +715,11 @@ def init_reader(self): |
716 | 715 | "()Ljava/lang/Throwable;") |
717 | 716 | if jutil.is_instance_of( |
718 | 717 | je, "java/io/FileNotFoundException"): |
719 | | - raise exceptions.IOError( |
720 | | - errno.ENOENT, |
| 718 | + raise IOError( |
| 719 | + errno.ENOENT, |
721 | 720 | "The file, \"%s\", does not exist." % path, |
722 | 721 | path) |
723 | | - e2 = exceptions.IOError( |
| 722 | + e2 = IOError( |
724 | 723 | errno.EINVAL, "Could not load the file as an image (see log for details)", |
725 | 724 | self.path.encode('utf-8')) |
726 | 725 | raise e2 |
|
0 commit comments