[Qgis-user] Using QGIS 3.0 in a python script outside the GUI

Renaud Burck Renaud.Burck at ign.fr
Tue May 15 23:41:08 PDT 2018


Hi All,

I'm trying to create a Windows scheduled task using a python script calling QGIS processing algorithms in non-GUI mode.

I read this tutorial http://www.qgistutorials.com/fr/docs/running_qgis_jobs.html

Since it was written for QGIS 2.XX, I used this stackexchange thread to adapt the batch file defining Windows environment variables   : https://gis.stackexchange.com/questions/268573/environment-variables-for-qgis-3-plugin-development-on-windows

My batch file call a python script which atm only contains :

import sys
from qgis.core import *

# Initialize QGIS Application
QgsApplication.setPrefixPath("C:\\Program Files\\QGIS 3.0\\apps\\qgis", True)
app = QgsApplication([], False)
QgsApplication.initQgis()

print ('Hello QGIS!')

Problem is that I get an error telling me :

This application failed to start because it could not find or load the Qt platform plugin "windows"
in "".

I think it's when "app = QgsApplication([], False)" is called. And I don't get why....

Do you have any idea?

Best regards
Renaud BURCK



[IGN-RVB.wmf]

Renaud BURCK
_______________________________________________________________
Chef du département de la Photogrammétrie | Service de l'Imagerie et de l'Aéronautique
DIRECTION DE LA PRODUCTION DES REFERENTIELS
T + 33(0)3 44 24 90 08
Route de la Forêt de Verneuil-en-Halatte
BP 40125  60107 CREIL cedex 1
ign.fr - geoportail.gouv.fr



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20180516/a302f464/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4348 bytes
Desc: image001.png
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20180516/a302f464/attachment.png>


More information about the Qgis-user mailing list