<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<p>Hi Jukka,</p>
<p>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
<a class="moz-txt-link-freetext" href="https://github.com/gisinternals/buildsystem/issues/180#issuecomment-952121822">https://github.com/gisinternals/buildsystem/issues/180#issuecomment-952121822</a>
about that</p>
<p>Even<br>
</p>
<div class="moz-cite-prefix">Le 26/10/2021 à 18:15, Rahkonen Jukka
(MML) a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:baa35de0165b48d58277fa4d87dc000e@maanmittauslaitos.fi">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style>@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}span.Shkpostityyli17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}div.WordSection1
{page:WordSection1;}ol
{margin-bottom:0cm;}ul
{margin-bottom:0cm;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">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<o:p></o:p></span></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph"
style="margin-left:0cm;mso-list:l0 level1 lfo1"><span
lang="EN-US">python-3.7.9-amd64<o:p></o:p></span></li>
<li class="MsoListParagraph"
style="margin-left:0cm;mso-list:l0 level1 lfo1"><span
lang="EN-US">gdal-303-1928-x64-core MIS installer from
gisinternals<o:p></o:p></span></li>
<li class="MsoListParagraph"
style="margin-left:0cm;mso-list:l0 level1 lfo1"><span
lang="EN-US">GDAL-3.3.2.win-amd64-py3.7 MSI installer from
gisinternals<o:p></o:p></span></li>
</ul>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Now I have all from
above and I have adjusted paths a bit and I can get this
far:<o:p></o:p></span></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph"
style="margin-left:0cm;mso-list:l0 level1 lfo1"><span
lang="EN-US">Python 3.7.9 starts<o:p></o:p></span></li>
<li class="MsoListParagraph"
style="margin-left:0cm;mso-list:l0 level1 lfo1"><span
lang="EN-US">I can load osr with “from osgeo import osr”<o:p></o:p></span></li>
</ul>
<p class="MsoNormal"><span lang="EN-US">But if I try “from osgeo
import ogr” I get:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Traceback (most recent
call last):<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> File “<stdin>”,
line 1, in <module><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> File “c:/Program
Files\Python37\lib\site-packages\osgeo\ogr.py”, line 245, in
<module><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> import osr<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">ModuleNotFoundError: No
module named ‘osr’<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Same thing with “from
osgeo import gdal” but this time the error in on line 1931
in gdal.py and missing module is ‘ogr’.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">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:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># This file was
automatically generated by SWIG (<a
href="http://www.swig.org" moz-do-not-send="true">http://www.swig.org</a>).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># Version 4.0.2<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">#<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># Do not make changes to
this file unless you know what you are doing--modify<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># the SWIG interface
file instead.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">-Jukka Rahkonen-<o:p></o:p></span></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>