diff --git a/python/triskele/CreaTIFF.py b/python/triskele/CreaTIFF.py index 1514af0..49649cb 100644 --- a/python/triskele/CreaTIFF.py +++ b/python/triskele/CreaTIFF.py @@ -8,6 +8,7 @@ # # TODO details +from pathlib import Path import numpy as np import gdal @@ -41,7 +42,12 @@ def write(fname, X): dst_ds.FlushCache() def read(fname): - gdl_data = gdal.Open(str(fname)) + pname = Path(fname) + + if not pname.exists(): + raise IOError('File not found: {}'.format(pname)) + + gdl_data = gdal.Open(pname.as_posix()) if gdl_data.RasterCount == 1: return gdl_data.ReadAsArray()