<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Can you change in __init__.py<br>
</p>
<p> try:<br>
os.add_dll_directory(p)<br>
except FileNotFoundError:<br>
continue</p>
<p><br>
</p>
<p>to</p>
<p> try:<br>
os.add_dll_directory(p)<br>
except (FileNotFoundError, OSError):<br>
continue</p>
<div class="moz-cite-prefix">Le 13/10/2021 à 15:20, Pedro Venâncio a
écrit :<br>
</div>
<blockquote type="cite"
cite="mid:CAMCJChuCya2nUXVOe+ARLvu2JeKqZo17xjovx5QzRy_Q2d9Yew@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr"><br>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div>
<p>But I don't understand why you still get the "On
Windows, with Python >= 3.8, DLLs are no longer
imported from the PATH." error message. <br>
</p>
<p>It shouldn't be emitted because
USE_PATH_FOR_GDAL_PYTHON is set:
<a
href="https://github.com/OSGeo/gdal/blob/f3a83a2c2628219bdc60001580da677758015a60/gdal/swig/python/osgeo/__init__.py#L25"
target="_blank" moz-do-not-send="true">https://github.com/OSGeo/gdal/blob/f3a83a2c2628219bdc60001580da677758015a60/gdal/swig/python/osgeo/__init__.py#L25</a></p>
<p>Something weird happening here. Perhaps edit
<a
href="https://github.com/OSGeo/gdal/blob/f3a83a2c2628219bdc60001580da677758015a60/gdal/swig/python/osgeo/__init__.py#L25"
target="_blank" moz-do-not-send="true">https://github.com/OSGeo/gdal/blob/f3a83a2c2628219bdc60001580da677758015a60/gdal/swig/python/osgeo/__init__.py#L25</a>
to display os.environ<br>
</p>
</div>
</blockquote>
<div><br>
</div>
<div>Even, I was not setting the environment variable
correctly on conda. It needs to be</div>
<div><br>
</div>
<div>
<code>conda env config vars set USE_PATH_FOR_GDAL_PYTHON=YES</code>
</div>
<div><br>
</div>
<div>and then I already get<br>
</div>
<div>
<pre class="gmail-code gmail-highlight" lang="plaintext"><span id="gmail-LC1" class="gmail-line" lang="plaintext">conda env config vars list</span>
<span id="gmail-LC2" class="gmail-line" lang="plaintext">USE_PATH_FOR_GDAL_PYTHON = YES</span>
</pre>
</div>
<div>So, the error message had changed</div>
<div>
<pre class="gmail-code gmail-highlight" lang="plaintext"><span id="gmail-LC1" class="gmail-line" lang="plaintext">python demo.py</span>
<span id="gmail-LC2" class="gmail-line" lang="plaintext">Traceback (most recent call last):</span>
<span id="gmail-LC3" class="gmail-line" lang="plaintext"> File "demo.py", line 1, in <module></span>
<span id="gmail-LC4" class="gmail-line" lang="plaintext"> from osgeo import gdal</span>
<span id="gmail-LC5" class="gmail-line" lang="plaintext"> File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py", line 11, in <module></span>
<span id="gmail-LC6" class="gmail-line" lang="plaintext"> os.add_dll_directory(p)</span>
<span id="gmail-LC7" class="gmail-line" lang="plaintext"> File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\os.py", line 1109, in add_dll_directory</span>
<span id="gmail-LC8" class="gmail-line" lang="plaintext"> cookie = nt._add_dll_directory(path)</span>
<span id="gmail-LC9" class="gmail-line" lang="plaintext">OSError: [WinError 87] O parâmetro está incorreto: '.'</span>
</pre>
</div>
<div><br>
</div>
<div> </div>
</div>
</div>
</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>