[QGIS-Developer] Qgis > Creating an standalone application

Tim Sutton tim at kartoza.com
Fri Sep 6 08:23:02 PDT 2019


Hi

These notes are for QGIS 2.x but the process should be similar:

https://github.com/inasafe/inasafe/wiki/Development-under-Windows#create-a-shell-launcher

Hope that helps

Regards

Tim

> On 6 Sep 2019, at 15:35, Trs Bar <barre.tristan at gmail.com> wrote:
> 
> 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 location
> QgsApplication.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 ?
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

—









Tim Sutton

Co-founder: Kartoza
Ex Project chair: QGIS.org

Visit http://kartoza.com <http://kartoza.com/> to find out about open source:

Desktop GIS programming services
Geospatial web development
GIS Training
Consulting Services

Skype: timlinux 
IRC: timlinux on #qgis at freenode.net

I'd love to connect. Here's my calendar link <https://calendly.com/timlinux> to make finding time easy.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190906/2fe71b51/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: KartozaNewLogoThumbnail.jpg
Type: image/jpeg
Size: 6122 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190906/2fe71b51/attachment-0001.jpg>


More information about the QGIS-Developer mailing list