Skip to content

Commit d207360

Browse files
committed
Using another existing exception, and shorter message
1 parent 3e3fe30 commit d207360

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

nibabel/loadsave.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from .filebasedimages import ImageFileError
1818
from .imageclasses import all_image_classes
1919
from .arrayproxy import is_proxy
20-
from .py3k import FileNotFoundError, FileEmptyError
20+
from .py3k import FileNotFoundError
2121
from .deprecated import deprecate_with_version
2222

2323

@@ -38,9 +38,8 @@ def load(filename, **kwargs):
3838
'''
3939
if not op.exists(filename):
4040
raise FileNotFoundError("No such file: '%s'" % filename)
41-
4241
if op.getsize(filename) <= 0:
43-
raise FileEmptyError("Given file is empty: '%s'" % filename)
42+
raise ImageFileError("Empty file: '%s'" % filename)
4443
sniff = None
4544
for image_klass in all_image_classes:
4645
is_valid, sniff = image_klass.path_maybe_image(filename, sniff)

nibabel/py3k.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ class FileNotFoundError(IOError):
6767
pass
6868

6969

70-
class FileEmptyError(IOError):
71-
pass
72-
73-
7470
def getexception():
7571
return sys.exc_info()[1]
7672

0 commit comments

Comments
 (0)