Seth Strumwasser
Seth Strumwasser

Reputation: 19

PyQGIS processing registry is empty

I'm trying to run a standalone python script using PyQGIS and the processingRegistry is empty. I'm running the script from PyCharm which I am launching using the following batch file:

@echo off

call "C:\Program Files\QGIS 3.38.2\bin\o4w_env.bat"

call "C:\Program Files\QGIS 3.38.2\apps\grass\grass84\etc\env.bat"

@echo off

path %PATH%;"C:\Program Files\QGIS 3.38.2\apps\qgis\bin"

path %PATH%;"C:\Program Files\QGIS 3.38.2\apps\grass\grass84\lib"

path %PATH%;"C:\Program Files\QGIS 3.38.2\apps\Qt5\bin"

path %PATH%;"C:\Program Files\QGIS 3.38.2\apps\Python312\Scripts"

path %PATH%;"C:\Program Files\QGIS 3.38.2\bin"

set PYTHONPATH=%PYTHONPATH%;"C:\Program Files\QGIS 3.38.2\apps\qgis\python"

rem set PYTHONHOME="C:\Program Files\QGIS 3.38.2\apps\Python312"
 
pause

start "PyCharm aware of Quantum GIS" /B "C:\Program Files\JetBrains\PyCharm Community Edition 2024.2.3\bin\pycharm64.exe"

Python interpreter

I'm using C:/Program Files/QGIS 3.38.2/bin/python-qgis.bat as the Python interpreter.

The PyQGIS script

from qgis.core import *
from qgis import processing
from os.path import dirname as up

if __name__ == "__main__":

        QgsApplication.setPrefixPath("C:/Program Files/QGIS 3.38.2", True)

        # Create a reference to the QgsApplication.  Setting the
        # second argument to False disables the GUI.
        qgs = QgsApplication([], False)

        # Load providers
        qgs.initQgis()

        for alg in qgs.processingRegistry().algorithms():
                print(alg.id(), "->", alg.displayName())

Expected result

I'm expecting to see a list of the processing algorithms including the plugin I want to use.

Actual result

Nothing is printed out. qgs.processingRegistry().algorithms() returns an empty list.

Upvotes: 0

Views: 36

Answers (0)

Related Questions