Where is stored path to processing scripts folder in PyQGIS?
Version of QGIS is 3.16.
I want to get this path by Python script.
I suppose then, is stored in processing object:
from qgis import processing
Kadir Şahbaz
78.6k57 gold badges260 silver badges407 bronze badges
asked Jan 15, 2021 at 11:08
2 Answers 2
If you have not changed the default path, you can recreate it using the path of your profile using qgisSettingsDirPath method from the QgsApplication class.
user_directory = QgsApplication.qgisSettingsDirPath()
print(user_directory)
# C:/Users/vaclav/AppData/Roaming/QGIS/QGIS3\profiles\default/
processing_directory = os.path.join(user_directory,'processing/scripts')
print(processing_directory)
# C:/Users/vaclav/AppData/Roaming/QGIS/QGIS3\profiles\default/processing/scripts
answered Jan 15, 2021 at 11:57
-
If you are satisfied, you can validate it in order to mark the subject as resolved.Vincent Bré– Vincent Bré2021年01月15日 12:10:12 +00:00Commented Jan 15, 2021 at 12:10
My solution is:
from processing.core.ProcessingConfig import ProcessingConfig
print(ProcessingConfig.getSetting('SCRIPTS_FOLDERS'))
is simple and works at Python Console (opened QGIS project)
answered Jan 15, 2021 at 12:09