Bug report #12502

processing:runalg locks input file

Added by Maximilian Krambach over 4 years ago. Updated over 1 year ago.

Status:Closed
Priority:Normal
Assignee:Victor Olaya
Category:Processing/Core
Affected QGIS version:2.8.1 Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:20648

Description

processing.runalg run from python console seems to "lock" the input file (CutLayer)
so it can't be deleted while running a plugin.
There seems to be no option to close runalg after completion.

processing.runalg('gdalogr:cliprasterbymasklayer', layerToBeCut CutLayer,None, False, False, "", "output.tif")
os.remove(Cutlayer) -->fails

History

#1 Updated by Giovanni Manghi over 4 years ago

  • Category set to Processing/Core
  • Assignee set to Victor Olaya

#2 Updated by Julio Novoa over 4 years ago

When running a script, there is a lock on files created by processing.runalg(). This happens in several algorithms, on Windows and Mac.

#3 Updated by Carlos Hernando over 3 years ago

I am afraid that this issue remains in the current version 2.14.2. For instance, if I apply the "sieve" tool from the general GUI menu: Raster --> Analysis --> Sieve the input .tif image is realsed when the operation finished. However, if I apply the very same operation using the processing toolbox: GDAL/OGR --> Analysis --> Sieve, after compeltion the input .tif image remains locked by qgis-bin.exe and I cannot move or delete it. The same issue occurs if using the python console with "processing.runalg".

If you need any feedback from my side, please do not hesitate to let me know.

#4 Updated by Paolo Prosperi over 3 years ago

  • Target version set to Future Release - High Priority

I actually propose to give high priority to this bug.
Indeed, coupled with the other serious one in gdal_calc (and gdalogr:rastercalc, where a python error is thrown at the end of each and any calculation: #12760 plus https://trac.osgeo.org/osgeo4w/ticket/466 plus https://trac.osgeo.org/gdal/ticket/5666), it actually blocks me from automating raster algebra and other processes where a large amount of files are produced.

Carlos Hernando wrote:

I am afraid that this issue remains in the current version 2.14.2. For instance, if I apply the "sieve" tool from the general GUI menu: Raster --> Analysis --> Sieve the input .tif image is realsed when the operation finished. However, if I apply the very same operation using the processing toolbox: GDAL/OGR --> Analysis --> Sieve, after compeltion the input .tif image remains locked by qgis-bin.exe and I cannot move or delete it. The same issue occurs if using the python console with "processing.runalg".

If you need any feedback from my side, please do not hesitate to let me know.

#5 Updated by Jakub Kosik over 3 years ago

I found it's not only related to processing.

In my plugin I used a lot of temp *.shp files. After "del vlayer" I was able to remove shapefiles (at least in QGIS 2.8). After update to 2.14.3 all attempts to delete shapefile after "del vlayer" causes "WindowsError: [Error 32]"

#6 Updated by Giovanni Manghi over 2 years ago

  • Regression? set to No
  • Easy fix? set to No

#7 Updated by Nyall Dawson over 1 year ago

  • Resolution set to fixed/implemented
  • Description updated (diff)
  • Status changed from Open to Closed

Not an issue in 3.0

Also available in: Atom PDF