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

2021-10-26 Thread Even Rouault

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 “”, line 1, in 

  File “c:/Program Files\Python37\lib\site-packages\osgeo\ogr.py”, 
line 245, in 


    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 
).


# 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@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


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

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


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

2021-10-26 Thread Rahkonen Jukka (MML)
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 "", line 1, in 
  File "c:/Program Files\Python37\lib\site-packages\osgeo\ogr.py", line 245, in 

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).
# 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@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev