[QGIS-Developer] Qgis > Creating an standalone application

Trs Bar barre.tristan at gmail.com
Fri Sep 6 07:35:14 PDT 2019


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.

Correctly set PYTHONPATH :

set PYTHONPATH=C:\OSGeo4W64\apps\qgis\python

When i try to run my python script (copied from the official documentation
"PyQGIS Developper Cookbook"), we've got an error :

from qgis.core import *
# Supply path to qgis install
locationQgsApplication.setPrefixPath("C:\OSGeo4W64\apps\qgis", True)
# Create a reference to the QgsApplication.  Setting the# second
argument to False disables the GUI.
qgs = QgsApplication([], False)
# Load providers
qgs.initQgis()
# Write your code here to load some layers, use processing# algorithms, etc.
# Finally, exitQgis() is called to remove the# provider and layer
registries from memory

qgs.exitQgis()

Erreur :

ImportError: DLL load failed: %1 n’est pas une application Win32 valide.

Could you maybe help me ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190906/30291114/attachment.html>


More information about the QGIS-Developer mailing list