-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Not possible to read from file handles without warnings #508
Comments
The error comes from GDAL; it is trying to enforce file name conventions for GPKG files. The problem here is that we pass off a byte stream which contains the bytes of the GPKG and a randomly-generated filename without extension, but we don't currently detect that it is a GPKG file on our end in order to add the correct extension. I recall that with GPKG it is a little tricky; we can read the first few bytes to determine that it is an SQLite file, but I think GDAL does several more heuristics to determine that it is indeed a GPKG. I guess the other thing we could do is specifically ignore this warning internally when we know we are using bytes instead of a file path. |
I'm having the same issue. Is there any way I can silence the warning? |
You can filter it like any warning, e.g. like this: import warnings
import pyogrio
file = "C:\Temp\polygon_parcel\polygon-parcel.gpkg"
with open(file, "rb") as f:
with warnings.catch_warnings():
warnings.filterwarnings("ignore", ".*has GPKG application_id.*", RuntimeWarning)
pyogrio.read_dataframe(f) |
I think this would be a good (at least temporary / short-term) solution to avoid users seeing this warning |
Reading files with the method:
always raises a warning like:
I am using pyogrio version 0.10.0
if a byte stream is passed to read_dataframe, I guess the warning should not be raised.
The text was updated successfully, but these errors were encountered: