3

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.

Path in QGIS GUI

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

6

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
1
  • If you are satisfied, you can validate it in order to mark the subject as resolved. Commented Jan 15, 2021 at 12:10
4

My solution is:

from processing.core.ProcessingConfig import ProcessingConfig
print(ProcessingConfig.getSetting('SCRIPTS_FOLDERS'))

is simple and works at Python Console (opened QGIS project)

Taras
35.8k5 gold badges77 silver badges151 bronze badges
answered Jan 15, 2021 at 12:09

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.