If user writes to an open file (perhaps an in-memory temporary file) but does not reset the read pointer via seek to the beginning of the file, we attempt to read from the end of the file, read no bytes into the in-memory file we create, and then GDAL raises a confusing error because the input file in the in-memory file is not valid.
If the file is seekable, we should be able to seek to the beginning. Then, we can raise an error if there were no bytes read.
Per read-related issues raised in GeoPandas #3379.
If user writes to an open file (perhaps an in-memory temporary file) but does not reset the read pointer via
seek
to the beginning of the file, we attempt to read from the end of the file, read no bytes into the in-memory file we create, and then GDAL raises a confusing error because the input file in the in-memory file is not valid.If the file is seekable, we should be able to seek to the beginning. Then, we can raise an error if there were no bytes read.