Class: QgsPythonRunner

class qgis.core.QgsPythonRunner

Bases: sip.wrapper

Protected constructor: can be instantiated only from children

QgsPythonRunner(QgsPythonRunner)

Utility class for running Python commands from various parts of QGIS. There is no direct Python support in the core library, so it is expected that application with Python support creates a subclass that implements pure virtual function(s) during the initialization. The static methods will then work as expected.

Added in QGIS v?

Enums

Methods

eval Eval a Python statement
evalCommand
isValid Returns True if the runner has an instance (and thus is able to run commands) *
run Execute a Python statement
runCommand
setInstance Assign an instance of Python runner so that run() can be used.

Signals

Attributes

eval(command: str) → Tuple[bool, str]

Eval a Python statement

evalCommand(self, command: str, result: str) → bool
isValid() → bool

Returns True if the runner has an instance (and thus is able to run commands) *

run(command: str, messageOnError: str = '') → bool

Execute a Python statement

runCommand(self, command: str, messageOnError: str = '') → bool
setInstance(runner: QgsPythonRunner)

Assign an instance of Python runner so that run() can be used. This method should be called during app initialization. Takes ownership of the object, deletes previous instance. *