<div dir="ltr">
<p>I'm new to GIS but i've already a signifiant experience in
development. I work on new project. We're trying to use the power of
Qgis to create a GIS tool for our commercial team.
QGis is istalled from OSGeo4W (3.8), Python (3.7) and PyQt (from pip)
are installed too.</p>
<p>Correctly set PYTHONPATH : </p>
<pre class="gmail-m_1087828789044709813gmail-lang-py gmail-m_1087828789044709813gmail-prettyprint gmail-m_1087828789044709813gmail-prettyprinted"><code><span class="gmail-m_1087828789044709813gmail-pln">set PYTHONPATH</span><span class="gmail-m_1087828789044709813gmail-pun">=</span><span class="gmail-m_1087828789044709813gmail-pln">C</span><span class="gmail-m_1087828789044709813gmail-pun">:</span><span class="gmail-m_1087828789044709813gmail-pln">\O</span><span class="gmail-m_1087828789044709813gmail-typ">SGeo4W64</span><span class="gmail-m_1087828789044709813gmail-pln">\apps\qgis\python</span></code></pre>
<p>When i try to run my python script (copied from the official documentation "PyQGIS Developper Cookbook"), we've got an error : </p>
<pre class="gmail-m_1087828789044709813gmail-lang-py gmail-m_1087828789044709813gmail-prettyprint gmail-m_1087828789044709813gmail-prettyprinted"><code><span class="gmail-m_1087828789044709813gmail-kwd">from</span><span class="gmail-m_1087828789044709813gmail-pln"> qgis</span><span class="gmail-m_1087828789044709813gmail-pun">.</span><span class="gmail-m_1087828789044709813gmail-pln">core </span><span class="gmail-m_1087828789044709813gmail-kwd">import</span><span class="gmail-m_1087828789044709813gmail-pln"> </span><span class="gmail-m_1087828789044709813gmail-pun">*</span><span class="gmail-m_1087828789044709813gmail-pln">
</span><span class="gmail-m_1087828789044709813gmail-com"># Supply path to qgis install location</span><span class="gmail-m_1087828789044709813gmail-pln">
</span><span class="gmail-m_1087828789044709813gmail-typ">QgsApplication</span><span class="gmail-m_1087828789044709813gmail-pun">.</span><span class="gmail-m_1087828789044709813gmail-pln">setPrefixPath</span><span class="gmail-m_1087828789044709813gmail-pun">(</span><span class="gmail-m_1087828789044709813gmail-str">"C:\OSGeo4W64\apps\qgis"</span><span class="gmail-m_1087828789044709813gmail-pun">,</span><span class="gmail-m_1087828789044709813gmail-pln"> </span><span class="gmail-m_1087828789044709813gmail-kwd">True</span><span class="gmail-m_1087828789044709813gmail-pun">)</span><span class="gmail-m_1087828789044709813gmail-pln">
</span><span class="gmail-m_1087828789044709813gmail-com"># Create a reference to the QgsApplication. Setting the</span><span class="gmail-m_1087828789044709813gmail-pln">
</span><span class="gmail-m_1087828789044709813gmail-com"># second argument to False disables the GUI.</span><span class="gmail-m_1087828789044709813gmail-pln">
qgs </span><span class="gmail-m_1087828789044709813gmail-pun">=</span><span class="gmail-m_1087828789044709813gmail-pln"> </span><span class="gmail-m_1087828789044709813gmail-typ">QgsApplication</span><span class="gmail-m_1087828789044709813gmail-pun">([],</span><span class="gmail-m_1087828789044709813gmail-pln"> </span><span class="gmail-m_1087828789044709813gmail-kwd">False</span><span class="gmail-m_1087828789044709813gmail-pun">)</span><span class="gmail-m_1087828789044709813gmail-pln">
</span><span class="gmail-m_1087828789044709813gmail-com"># Load providers</span><span class="gmail-m_1087828789044709813gmail-pln">
qgs</span><span class="gmail-m_1087828789044709813gmail-pun">.</span><span class="gmail-m_1087828789044709813gmail-pln">initQgis</span><span class="gmail-m_1087828789044709813gmail-pun">()</span><span class="gmail-m_1087828789044709813gmail-pln">
</span><span class="gmail-m_1087828789044709813gmail-com"># Write your code here to load some layers, use processing</span><span class="gmail-m_1087828789044709813gmail-pln">
</span><span class="gmail-m_1087828789044709813gmail-com"># algorithms, etc.</span><span class="gmail-m_1087828789044709813gmail-pln">
</span><span class="gmail-m_1087828789044709813gmail-com"># Finally, exitQgis() is called to remove the</span><span class="gmail-m_1087828789044709813gmail-pln">
</span><span class="gmail-m_1087828789044709813gmail-com"># provider and layer registries from memory</span><span class="gmail-m_1087828789044709813gmail-pln">
qgs</span><span class="gmail-m_1087828789044709813gmail-pun">.</span><span class="gmail-m_1087828789044709813gmail-pln">exitQgis</span><span class="gmail-m_1087828789044709813gmail-pun">()<br><br></span></code></pre><pre class="gmail-m_1087828789044709813gmail-lang-py gmail-m_1087828789044709813gmail-prettyprint gmail-m_1087828789044709813gmail-prettyprinted"><code><span class="gmail-m_1087828789044709813gmail-pun">Erreur :<br></span></code></pre>
<pre class="gmail-m_1087828789044709813gmail-lang-py gmail-m_1087828789044709813gmail-prettyprint gmail-m_1087828789044709813gmail-prettyprinted"><code><span class="gmail-m_1087828789044709813gmail-typ">ImportError</span><span class="gmail-m_1087828789044709813gmail-pun">:</span><span class="gmail-m_1087828789044709813gmail-pln"> DLL load failed</span><span class="gmail-m_1087828789044709813gmail-pun">:</span><span class="gmail-m_1087828789044709813gmail-pln"> </span><span class="gmail-m_1087828789044709813gmail-pun">%</span><span class="gmail-m_1087828789044709813gmail-lit">1</span><span class="gmail-m_1087828789044709813gmail-pln"> n</span><span class="gmail-m_1087828789044709813gmail-pun">’</span><span class="gmail-m_1087828789044709813gmail-pln">est pas une application </span><span class="gmail-m_1087828789044709813gmail-typ">Win32</span><span class="gmail-m_1087828789044709813gmail-pln"> valide</span><span class="gmail-m_1087828789044709813gmail-pun">.<br><br></span></code></pre><pre class="gmail-m_1087828789044709813gmail-lang-py gmail-m_1087828789044709813gmail-prettyprint gmail-m_1087828789044709813gmail-prettyprinted"><code><span class="gmail-m_1087828789044709813gmail-pun">Could you maybe help me ?</span></code></pre>
</div>