diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b21c6834..d0135bbef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## Version 1.8.6 + +### Bug Fixes +- A change in the Glymur library affected how missing files were handled ([#675](../../pull/675)) + ## Version 1.8.5 ### Improvements diff --git a/sources/gdal/large_image_source_gdal/__init__.py b/sources/gdal/large_image_source_gdal/__init__.py index 5a606c94e..ed4f952af 100644 --- a/sources/gdal/large_image_source_gdal/__init__.py +++ b/sources/gdal/large_image_source_gdal/__init__.py @@ -25,8 +25,11 @@ import numpy import palettable import PIL.Image -import pyproj -from osgeo import gdal, gdal_array, gdalconst, osr +from osgeo import gdal, gdal_array, gdalconst, osr # noqa I001 +# pyproj stopped supporting older pythons, so its database is aging; as such, +# if on those older versions of python if it is imported before gdal, there can +# be a database version conflect; importing after gdal avoids this. +import pyproj # noqa I001 from pkg_resources import DistributionNotFound, get_distribution import large_image diff --git a/sources/openjpeg/large_image_source_openjpeg/__init__.py b/sources/openjpeg/large_image_source_openjpeg/__init__.py index 1cc14c51a..c43df0065 100644 --- a/sources/openjpeg/large_image_source_openjpeg/__init__.py +++ b/sources/openjpeg/large_image_source_openjpeg/__init__.py @@ -92,6 +92,10 @@ def __init__(self, path, **kwargs): self._pixelInfo = {} try: self._openjpeg = glymur.Jp2k(largeImagePath) + if not self._openjpeg.shape: + if not os.path.isfile(self._largeImagePath): + raise FileNotFoundError() + raise TileSourceError('File cannot be opened via Glymur and OpenJPEG.') except (glymur.jp2box.InvalidJp2kError, struct.error): raise TileSourceError('File cannot be opened via Glymur and OpenJPEG.') except FileNotFoundError: