[Qgis-user] Cannot run external scripts with QGIS 3.2 on Mac OS X 10.12

Chris B snowstorms at mac.com
Thu Aug 2 17:04:17 PDT 2018


Hello, I also posted this on StackExchange but since it seems like an
installation/config issue this might be a better place to find out.  I am
trying to move some automation out of the QGIS 3.2 GUI and into some
external python scripts, and I am having a challenge getting a script to run
in the MacOS X 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)



--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html



More information about the Qgis-user mailing list