[gdal-dev] GDALOpenEx() not failing silently

Joaquim Manuel Freire Luís jluis at ualg.pt
Sun Jun 29 12:52:24 PDT 2025


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<mailto: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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250629/c3293d90/attachment-0001.htm>


More information about the gdal-dev mailing list