0

I am developing a QGIS plugin which is calling an exe with the help of subprocess.check_output.

The plugin was working fine in Linux but now when I am trying to make it compatible to windows, the subprocess.check_output is not working. I have done some appropriate changes for the windows.

I am trying:

command = 'laszip.exe -i' + ' "'  + nameofinputdir + "\\"  + fname + '" -odir "' + nameofoutputdir + '" -olaz'
output1 = subprocess.check_output(command, shell=True).

and I am getting this error:

CalledProcessError: Command 'laszip.exe -i "E:\QGIS\IPfiles\IowaDNR-stippled-overlap2.las" -odir "E:\QGIS\opp" -olaz' returned non-zero exit status 1

This command is working fine when I am running it on the Command Prompt but not through this python script.

mkirk
  • 3,965
  • 1
  • 26
  • 37
Sumeet Jain
  • 35
  • 2
  • 7
  • can you include the output of running it on the command prompt, including the exit status returned? (http://stackoverflow.com/questions/334879/how-do-i-get-the-application-exit-code-from-a-windows-command-line) – mkirk Nov 16 '15 at 23:53
  • Actually the command: laszip.exe -i "E:\QGIS\IPfiles\IowaDNR-stippled-overlap2.las" -odir "E:\QGIS\opp" -olaz is a command to convert the las files to laz files. it is using a tool name laszip.exe. So when i run this on the command prompt, it is creating the desired file at the stated location. But when i am doing this from the python script using the subprocess.check_output(), it is showing error. – Sumeet Jain Nov 17 '15 at 02:00
  • 1
    The problem is solved now.I just had to add the os.chdir(directoryAddress) to go to the particular location and then perform the subprocess.check_output command. – Sumeet Jain Nov 17 '15 at 07:43
  • can you post your own answer and mark it as answered so other folks can benefit from seeing this had a solution? – mkirk Nov 18 '15 at 00:23

0 Answers0