Saturday 6 August 2016

installation - Cannot run external scripts with QGIS 3.2 on Mac OS X 10.12


I am trying to move some automation out of the GUI and into some external python scripts, and I am having a challenge getting a script to run in Terminal.


I have a fully functioning install of QGIS 3.2, can run commands in the console in app etc.


But trying even a basic hello world crashes when I try to run it: the following:


from qgis.core import *

QgsApplication.setPrefixPath("/Applications/QGIS3.app/Contents/MacOS", True)
qgs = QgsApplication([], False)

qgs.initQgis()
qgs.exitQgis()

produces this error:


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

Reinstalling the application may fix this problem.
Abort trap: 6

Does anyone have a workaround or specific list of bash_profile variables to have things set up correctly? Do I need to import Qt or similar in the script (this was pulled directly from the QGIS Documentation site)





No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...