1

My task is to run QGIS in standalone script. All the modules import correctly and I am running QGIS in conda environment. Error occurs when running the processing.run() command

QgsProcessingException: Process gdal2xyz.bat failed to start. Either gdal2xyz.bat is missing, or you may have insufficient permissions to run the program.

Here is the code I am running. Only the last line causes error.

import sys
from qgis.core import (
     QgsApplication
)
qgs = QgsApplication([], False)
qgs.initQgis()

import processing from processing.core.Processing import Processing Processing.initialize()

processing.run("gdal:gdal2xyz", {'INPUT':r'D:\dummy\K.tif','BAND':1,'CSV':True, 'OUTPUT':r'D:\dummy\K.csv'})

Since I am using conda environment, QGIS_PREFIX_PATH, PYTHONPATH are already set as shown below:

enter image description here

I am unable to comprehend the error and resolve it. I followed the instructions from Using QGIS 3 Processing algorithms from PyQGIS standalone scripts (outside of GUI). Running Python 3.9.4 and QGIS 3.18.3.

menes
  • 1,421
  • 2
  • 7
  • 24
Aman Bagrecha
  • 1,055
  • 5
  • 14

0 Answers0