Skip to content

Instantly share code, notes, and snippets.

@jenningsanderson
Last active August 6, 2018 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jenningsanderson/8940410 to your computer and use it in GitHub Desktop.
Save jenningsanderson/8940410 to your computer and use it in GitHub Desktop.
Custom Initialization for running standalone PyQGIS processing.
'''
Standalone QGIS Initilization Script for QGis running on Mac OS X
'''
import os
import sys
#Implicitly define where plugins are for QGIS
sys.path.append('/Applications/QGis.app/Contents/Resources/python/')
sys.path.append('/Applications/QGis.app/Contents/Resources/python/plugins')
#Import QGIS
from qgis.core import *
#If we don't initialize the app, it will crash
app = QgsApplication([],True)
QgsApplication.setPrefixPath(r"/Applications/QGIS.app/Contents/Plugins", True)
QgsApplication.initQgis()
import PyQt4
from PyQt4 import QtCore, QtGui
#Most important module:
import processing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment