6

qgis_process allows us to run scripts already installed in QGIS from the command line. But is there a way to run qgis scripts not yet installed?

e.g. if I have a file script.py

from qgis.core import QgsProcessing
# (...etc...)
class Foo(QgsProcessingAlgorithm):
    # defines my algorithm, which works fine in qgis

Can qgis_process or some other tool run this from the command line without me having to add script.py to the toolbox in qgis first?

The command-line help to qgis_process is encouraging in that it says

(...) run runs an algorithm. The algorithm id or a path to a model file and parameter values must be specified. Parameter values are specified via the --PARAMETER=VALUE syntax

But if I provide a path to script.py (with or without the .py) it says not found.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Sideshow Bob
  • 2,333
  • 14
  • 20
  • 3
    It sounds like you want to run a python script that calls QGIS processing outside of a QGIS Python window. See this link for help: https://gis.stackexchange.com/questions/200510/no-module-named-qgis – GBG Mar 11 '21 at 16:18

0 Answers0