[GIS] Using the Processing Framework in QGIS 2.0

importpyqgispythonqgisqgis-processing

I am writing a plugin for QGIS 2.0, and I want to use the processing framework to call some functions.

When I open the pyhton console inside QGIS, I am able to call it like this:

    >> import processing

And then, for instance:

    >>> processing.alglist()

However, if I try to import it in my Python Plugin, it fails to find the processing include:

    from qgis.core import *
    from qgis.gui import *
    import processing

I googled the problem and found this directives:

    from processing.core.Processing import Processing
    from processing.core.ProcessingConfig import Setting, ProcessingConfig

But unfortunately it also does not work for me :-/

Does anybody know how to include the qgis processing framework in a plugin, and how to call the algorithm (lets say for instance "processing.runalg(…)

I really appreciate your answers, as I found many explanations on how-to do it in the Python console, but not outside QGIS :-/

Thanks again for your time and have a nice day,
Joana

Best Answer

Ok, I will answer my own question. Using *exactly*the same imports as in the python console works; is just a problem of pydev, that doesn't recognize the libraries (I probably need to add a reference in the project somewhere)