[gdal-dev] GDALOpenEx() not failing silently
Even Rouault
even.rouault at spatialys.com
Sun Jun 29 13:18:29 PDT 2025
When GDAL_OF_VERBOSE_ERROR is not set, GDALOpenEx(), the generic opening
logic, doesn't emit a CPLError(). Here the error is emitted by the XYZ
driver itself. Normally the Open() method of drivers isn't supposed to
emit errors until it is that the input dataset belong to them. The XYZ
driver is a bit particular, because it doesn't have much hints to know
if a dataset is a XYZ (with a structure it can't handle, hence an error
message) or not.
Le 29/06/2025 à 21:52, Joaquim Manuel Freire Luís a écrit :
>
> Thanks
>
> Silenced now. But if the GDALOpenEx docs say
>
> Verbose error: GDAL_OF_VERBOSE_ERROR. If set, a failed attempt to open
> the file will lead to an error message to be reported.
>
> When it is not set (the case here) it should not need this “extra
> care”, no?
>
> *From:*Even Rouault <even.rouault at spatialys.com>
> *Sent:* Sunday, June 29, 2025 8:24 PM
> *To:* Joaquim Manuel Freire Luís <jluis at ualg.pt>; gdal-dev at lists.osgeo.org
> *Subject:* Re: [gdal-dev] GDALOpenEx() not failing silently
>
> Hi,
>
> you can surround the call to GDALOpenEx() with
>
> CPLPushErrorHandler(CPLQuietErrorHandler);
>
> ... GDALOpenEx() here ...
>
> CPLPopErrorHandler();
>
> Le 29/06/2025 à 21:20, Joaquim Manuel Freire Luís via gdal-dev a écrit :
>
> Hi,
>
> Again the Julia wrapper. In it to find if a file holds a raster or
> a vector I first open it with GDAL_OF_RASTER and see it the return
> pointer is NULL. This has been working well and SILENTLY when it
> fail (because a OGR vector file name was passed in). But with
> these Meteostat .csv.gz files it fails (expected) but prints an
> ERROR 1 message.
>
> The closes (to C and perhaps Python) I can reproduce is this
>
> julia>
> GMT.Gdal.GDALOpenEx("/vsigzip//vsicurl/https://bulk.meteostat.net/v2/daily/08554.csv.gz",
> GMT.Gdal.GDAL_OF_RASTER, C_NULL, C_NULL, C_NULL)
>
> ERROR 1: At line 1, did not find X, Y and/or Z values
>
> Ptr{Nothing} @0x0000000000000000
>
> All works right, but this error message is annoying (and normal
> users will not understand it).
>
> Anything I can do to shut it up?
>
> Joaquim
>
>
>
> _______________________________________________
>
> gdal-dev mailing list
>
> gdal-dev at lists.osgeo.org
>
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> --
> http://www.spatialys.com
> My software is free, but my time generally not.
--
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250629/3ee14a17/attachment.htm>
More information about the gdal-dev
mailing list