-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Harden detecting file-not-found. #726
Conversation
return True | ||
if ds.GetDriver().ShortName in {'NITF', 'netCDF'}: | ||
return True | ||
if ds: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the conda installation, GDAL returns a dataset handle even when the file isn't found. In the pip installation, it raises an exception. Both have gdal 3.4.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is very odd... I wonder what exactly causes this difference? Perhaps a build flag? This would be good to raise in the GDAL conda-forge feedstock
This handles some difference in the conda and pip installations of gdal.
92fba3c
to
e9e42c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that this is now raising a TileSourceFileNotFoundError
error for my, conda-based, GDAL installation:
>>> import large_image
>>> large_image.open('foo.tif')
Could not find Java JRE compatible with x86_64 architecture
Using python for large_image caching
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/bane/Software/kw/large_image/large_image/tilesource/__init__.py", line 143, in open
return getTileSource(*args, **kwargs)
File "/Users/bane/Software/kw/large_image/large_image/tilesource/__init__.py", line 131, in getTileSource
return getTileSourceFromDict(AvailableTileSources, *args, **kwargs)
File "/Users/bane/Software/kw/large_image/large_image/tilesource/__init__.py", line 118, in getTileSourceFromDict
raise TileSourceFileNotFoundError(pathOrUri)
large_image.exceptions.TileSourceFileNotFoundError: [Errno 2] foo.tif
>>> large_image.open('/vsicurl?url=https%3A%2F%2Ffoo.com%2Fbar.png&use_head=no&list_dir=no')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/bane/Software/kw/large_image/large_image/tilesource/__init__.py", line 143, in open
return getTileSource(*args, **kwargs)
File "/Users/bane/Software/kw/large_image/large_image/tilesource/__init__.py", line 131, in getTileSource
return getTileSourceFromDict(AvailableTileSources, *args, **kwargs)
File "/Users/bane/Software/kw/large_image/large_image/tilesource/__init__.py", line 118, in getTileSourceFromDict
raise TileSourceFileNotFoundError(pathOrUri)
large_image.exceptions.TileSourceFileNotFoundError: [Errno 2] /vsicurl?url=https%3A%2F%2Ffoo.com%2Fbar.png&use_head=no&list_dir=no
This handles some difference in the conda and pip installations of gdal.
Closes #656.