[gdal-dev] Python error in me or in gisinternals.com packages?

Even Rouault even.rouault at spatialys.com
Tue Oct 26 09:45:57 PDT 2021


Hi Jukka,

I just checked and indeed gisinternals uses SWIG 2 to generate python 
bindings, which is not Python 3 compatible. I've added a comment in 
https://github.com/gisinternals/buildsystem/issues/180#issuecomment-952121822 
about that

Even

Le 26/10/2021 à 18:15, Rahkonen Jukka (MML) a écrit :
>
> Hi,
>
> I can use GDAL Python bindings from OSGeo4W installation but folks in 
> gis.stackexchange have problems with the gistinternals.com binaries so 
> I had a try too. I installed
>
>   * python-3.7.9-amd64
>   * gdal-303-1928-x64-core MIS installer from gisinternals
>   * GDAL-3.3.2.win-amd64-py3.7 MSI installer from gisinternals
>
> Now I have all from above and I have adjusted paths a bit and I can 
> get this far:
>
>   * Python 3.7.9 starts
>   * I can load osr with “from osgeo import osr”
>
> But if I try “from osgeo import ogr” I get:
>
> Traceback (most recent call last):
>
>   File “<stdin>”, line 1, in <module>
>
>   File “c:/Program Files\Python37\lib\site-packages\osgeo\ogr.py”, 
> line 245, in <module>
>
>     import osr
>
> ModuleNotFoundError: No module named ‘osr’
>
> Same thing with “from osgeo import gdal” but this time the error in on 
> line 1931 in gdal.py and missing module is ‘ogr’.
>
> Do the errors mean that the Python stuff is using deprecated “import 
> osr” and “import ogr” while they should have it as “import osgeo.osr” 
> and “import osgeo.ogr” as they seem to stand in the working OSGeo4W 
> installation? I do not have rights to edit the files, and they have 
> also this warning in the beginning:
>
> # This file was automatically generated by SWIG (http://www.swig.org 
> <http://www.swig.org>).
>
> # Version 4.0.2
>
> #
>
> # Do not make changes to this file unless you know what you are 
> doing--modify
>
> # the SWIG interface file instead.
>
> -Jukka Rahkonen-
>
>
> _______________________________________________
> 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211026/1a147a23/attachment.html>


More information about the gdal-dev mailing list