Hello,
I' m trying to access commands from the processing toolbox from outside a QGIS Session via Python. I found an example made by Ujaval Gandhi (spatialthoughts.com) which contains the following: # Add the path to Processing framework sys.path.append('c:\\Users\\myUsername\\.qgis2\\python\\plugins') # Import and initialize Processing framework from processing.core.Processing import Processing Processing.initialize() import processing That did not work for me (in QGIS 2.12 and 2.14), I got an error message "Import error: no module named processing.core.Processing". I checked the path and found that there is no file "Processing.py" in that folder under .qgis2. So I wonder how it should be found there? Now, I started to look for the file myself using the command window MS-DOS: dir /s processing.py, and the file was found in: Verzeichnis von C:\Program Files\QGIS Essen\apps\qgis\python\processing\core Processing.py 15.578 Bytes ... I tried that path for sys.path.append() in the above code and got the same error as before. Then, I started QGIS (by the way: I started it just as a check. I'd like to create a script that works from outside QGIS). In the QGIS Python console, it' no problem to import processing. That means that it is present on the computer. So I checked the path that is used here: import sys print sys.path I got a very long confusing list, but the only entry containing the string "processing" is: 'C:/PROGRA~1/QGISES~1/apps/qgis/./python/plugins\\processing' So I thougt that this must be the path to import processing. But trying exactly that in the above code, I got the same error as above. Now, my questions are: what did I do wrong? where is Processing.py to be found? Why did my search produce wrong results? Am I wrong in assuming that I have to provide the path to "Pythonfile.py" if I want "import Pythonfile" to work?? Thanks and regards, Uwe
_______________________________________________ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user