Run processing toolbox outside QGIS in standalone app

المشرف العام

Administrator
طاقم الإدارة
I am developing a standalone app in Python, using QGIS libraries including processing algorithms. I am developing in Linux environment and I put the libraries in a folder. Also I put the processing folder from QGIS in that same folder. I run the app but when I import the processing folder, it gives me nothing (not even error messages).

I import like that:

import processing.core.ProcessingCan you help me?

CODE:

import sysimport qgis.coreimport PyQt4.QtCoreimport PyQt4.QtGuiapp = qgis.core.QgsApplication([],True)qgis.core.QgsApplication.setPrefixPath("/usr", True)qgis.core.QgsApplication.initQgis()(from here the program doesn't work)

from processing.core.Processing import ProcessinginputLayer = 'c:....'inputMask = 'c:....'extent = ....cellsize = ....outPath = 'c:.....'Processing.Initialize()Processing.runalgorith(.....)UPDATE:

Ok, I download the folder with the processing version 2.2.0-2 and I copied to my script folder. I run and it gives me this error:

Traceback (most recent call last): File "teste.py", line 12, in from processing.core.Processing import Processing File "/home/p/Programas/processing/__init__.py", line 28, in from processing.tools.dataobjects import * File "/home/p/Programas/processing/tools/dataobjects.py", line 33, in from processing.core.ProcessingConfig import ProcessingConfig File "/home/p/Programas/processing/core/ProcessingConfig.py", line 30, in from processing.tools.system import * File "/home/p/Programas/processing/core/processing.py", line 33, in from processing import interfaceImportError: cannot import name interfaceI still have no answer.

UPDATE:

I got it!! What is missing in my case was to define the PYTHONPATH to the folder with the processing. Now I have the correct running of the code.

Thanks for the help.



أكثر...
 
أعلى