[Qgis-user] QGIS 3 Standalone Python Script
William Kyngesburye
woklist at kyngchaos.com
Sat Aug 4 18:33:38 PDT 2018
Did you install PyQt5 separately from QGIS? It's included in the QGIS app, but if you append QGIS to the python path python will not see the QGIS PyQt5.
Try an insert instead:
sys.path.insert(0,'/Applications/QGIS3.app/Contents/Resources/python/')
sys.path.insert(0,'/Applications/QGIS3.app/Contents/Resources/python/plugins')
> On Aug 3, 2018, at 5:17 PM, DT <dmofot at gmail.com> wrote:
>
> OSX, version 10.13.6
> Python 3.6.6
> QGIS 3.2.1
>
> QGIS itself is working fine with no errors, but I'm trying to write a standalone python script that utilizes a QGIS3 tool and I keep running into Qt errors. This works fine:
>
> import os
> import sys
> sys.path.append('/Applications/QGIS3.app/Contents/Resources/python/')
> sys.path.append('/Applications/QGIS3.app/Contents/Resources/python/plugins')
> from qgis.core import *
>
> But as soon as I try to do:
>
> app = QgsApplication([],True)
>
> I get the following error:
>
> >>> app = QgsApplication([],True)
> 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
>
> Anybody have an idea where I'm going wrong? My Google fu has only managed to turn up setting paths for Windows and not OSX. Thanks!
>
> DT
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/
"Mon Dieu! but they are all alike. Cheating, murdering, lying, fighting, and all for things that the beasts of the jungle would not deign to possess - money to purchase the effeminate pleasures of weaklings. And yet withal bound down by silly customs that make them slaves to their unhappy lot while firm in the belief that they be the lords of creation enjoying the only real pleasures of existence....
- the wisdom of Tarzan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20180804/c0ef8b1f/attachment.html>
More information about the Qgis-user
mailing list