subprocess.call not working, but os.system is

المشرف العام

Administrator
طاقم الإدارة
I am working on a plugin for QGIS (2.10.o-Pisa) and want to clip a raster dataset based on coordinates. I originally develop the plugin in Window but now when I try this on Linux (Ubuntu 14.04) it gives me errors. Here is what I do:

subprocess.call("gdalwarp -dstnodata -9999 -q -overwrite -te 532179.024828 181447.85927 532579.024828 181847.85927 -of GTiff /home/fredrik/Documents/dsm.tif /home/fredrik/Documents/data/clipdsm.tif, shell=True")The error prodeuced in QGIS is:

"Traceback (most recent call last):

File "/home/fredrik/.qgis2/python/plugins/UMEP/ImageMorphParmsPoint/imagemorphparmspoint_v1.py", line 454, in start_process subprocess.call(gdalruntextdsm)

File "/usr/lib/python2.7/subprocess.py", line 522, in call return Popen(*popenargs, **kwargs).wait()

File "/usr/lib/python2.7/subprocess.py", line 710, in init errread, errwrite)

File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception

OSError: [Errno 2] No such file or directory"

gdalruntextdsm includes the textstring shown in the code above.I tried it in a shell and there it works fine. I tried os.system instead and that worked! However, I dont want to use this in Windows since it gives me a cmd-window.

Any suggestions?



أكثر...
 
أعلى