GDAL_DATA is evaluated as the argument of fopen(), so if it is relative, you need to be a current directory consistent with the relative path for it to work. You'd generally want ot use an absolute path for GDAL_DATA

I see that in pytest.ini a commented line with #GDAL_DATA = ../gdal/data. And autotest/conftest.py has logic to chdir() in the directory where each test is run, and it happens our arborescence of test is autotest/foo, so the value of ../gdal/data does not work. It should rather be ../../gdal/data . We should probably fix that line, but I'm wondering if it is a good idea to set it at all in pytest.ini. A dev environment without GDAL_DATA set wouldn't be functional outside of pytest. A nice improvement would be to detect that we run from a dev environment and automatically figure out the GDAL_DATA directory from that (qgis has some magic for similar situation), but that might be fragile and need a bit of rework if some day we use another build system :-)

Le 26/04/2021 à 23:51, Andrew Bell a écrit :


On Mon, Apr 26, 2021 at 10:44 AM Even Rouault <[email protected] <mailto:[email protected]>> wrote:

    DGN writing indeeds need GDAL_DATA to be set and point to the
    directory that contains seed_2d.dgn

Is it the case that GDAL_DATA is relative to the directory containing the test rather than the test driver directory (autotest)? Changing a relative path to an absolute one allowed the seed file to be found. This seemed strange because the provided pytest.ini contains a relative path. Is there some other variable that sets the base path to be used?

Thanks,

--
Andrew Bell
[email protected] <mailto:[email protected]>

--
http://www.spatialys.com
My software is free, but my time generally not.

_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to