When trying to use processing.run()
from a standalone (no GUI) mode, I get the following error:
module 'qgis.processing' has no attribute 'run'
in the following trivial example:
from qgis import processing
result = processing.run("native:buffer", {'INPUT': 'test', 'OUTPUT': 'memory:'})
Other methods, like algorithmHelp()
, don't seem to work either.
I followed the Windows setup instructions from here:
https://docs.qgis.org/3.16/en/docs/pyqgis_developer_cookbook/intro.html#running-custom-applications
Setting the following environment vars:
PYTHONPATH=C:\OSGeo4W\apps\qgis\python
and PATH
is appended with C:\OSGeo4W\bin;C:\OSGeo4W\apps\qgis\bin
Anything I'm missing here?
NOTE: When running the same script from inside the GUI (using the Script editor), all goes well and I don't get these errors. Somehow the environment seems to be different between the two.
QGIS version is 3.22.2-Białowieża.