diff --git a/niwidgets/exampledata.py b/niwidgets/exampledata.py index 367ac3e..453069b 100644 --- a/niwidgets/exampledata.py +++ b/niwidgets/exampledata.py @@ -3,7 +3,7 @@ try: # on >3 this ships by default from pathlib import Path -except ModuleNotFoundError: +except ImportError: # on 2.7 this should work try: from pathlib2 import Path diff --git a/niwidgets/niwidget_surface.py b/niwidgets/niwidget_surface.py index 26312db..ce9a3aa 100644 --- a/niwidgets/niwidget_surface.py +++ b/niwidgets/niwidget_surface.py @@ -12,7 +12,7 @@ try: # on >3 this ships by default from pathlib import Path -except ModuleNotFoundError: +except ImportError: # on 2.7 this should work try: from pathlib2 import Path diff --git a/niwidgets/niwidget_volume.py b/niwidgets/niwidget_volume.py index 462024f..fa31ecd 100644 --- a/niwidgets/niwidget_volume.py +++ b/niwidgets/niwidget_volume.py @@ -10,13 +10,13 @@ try: # on >3 this ships by default from pathlib import Path -except ModuleNotFoundError: +except ImportError: # on 2.7 this should work try: from pathlib2 import Path - except ModuleNotFoundError: - raise ModuleNotFoundError('On python 2.7, niwidgets requires ' - 'pathlib2 to be installed.') + except ImportError: + raise ImportError('On python 2.7, niwidgets requires ' + 'pathlib2 to be installed.') class NiftiWidget: @@ -43,7 +43,6 @@ def __init__(self, filename): if hasattr(filename, 'get_data'): self.data = filename else: - filename = Path(filename).resolve() if not filename.is_file(): raise OSError('File ' + filename.name + ' not found.')