Linked Questions

3 votes
3 answers

can not delete file after using runalg function

I my plugin I use the runalg function: processing.runalg("qgis:clip",filepath + "/temp2.shp", Layer, filepath + '/' + layerName) vlayer = QgsVectorLayer(filepath + '/' + layerName + '.shp',layerName, ...
Toke's user avatar
  • 155
5 votes
1 answer

Deleting shapefile and related extension files from folder when not in use

I have to delete two shapefile layers from my folder. I use these shapefiles to run processing Algorithms after which i want to delete them. The code I use use is as given below. for filename in os....
rao's user avatar
  • 353
6 votes
0 answers

QGIS: Release file lock on file used in a processing algorithm at the end of script

I am using runalg (qgis:joinattributesbylocation) on two QgsVectorLayer objects. At the end of my script I'm trying to delete all the files created during the script. I can delete everything except ...
David M.'s user avatar
6 votes
1 answer

Standalone PyQGIS file lock

I have a simple script for processing thousands of rasters/shapefiles. i am not able to delete temporary files, which are created by processing. I can pass them to: 'memory:output_file' but not for ...
Jan Doležal's user avatar
5 votes
1 answer

Unload QgsVectorLayer from Python script

I have a Python script that processes several country sized OpenStreetMap PBF files at a time. The problem I'm having is that: each time I open and process one of these files, I lose anywhere from ...
Walter's user avatar
  • 249
3 votes
1 answer

Deleting shapefile after removing it with removeMapLayer using PyQGIS

I am currently working on a script that searches for a currently loaded layer in PyQGIS and does some calculations. Then it removes the layer and deletes the whole shapefile in its directory. ...
eagleadmiral's user avatar
3 votes
2 answers

pyqgis processing runalg release input in windows

I am having problems with deleting files on disk after using "processing.runalg()" in a plugin I created when running it in windows. I have no problem in linux. I found an issue regarding the same ...
Olivier's user avatar
  • 419
0 votes
0 answers

Unable to delete .shp and .dbf files from directory when on canvas PyQGIS

I am creating a standalone PyQGIS application and is met with a problem. When a shapefile is shown on my canvas, I am unable to delete the corresponding .shp and .dbf files in my directory. This is ...
Sean Ang's user avatar
  • 143
1 vote
0 answers

How can I get QGIS to release/unlock a geopackage with 1 layer after use in python? Geopackage/Permission Error (WinError 32)

I have a python script to update 4 authoritative geopackage files with additions and changes made to copies of the geopackages in the field (field geopackages). Once the new records and edited ...
JonJon's user avatar
  • 53
1 vote
0 answers

Files locked after running a Python script [closed]

I can run a Python script that uses qgsVectorLayer, qgsRasterLayer and many functions like processing:runalg("qgis.difference"......) and os.popen("gdalwarp -q -cutline.......) but if I want to run it ...
Namoat's user avatar
  • 307
1 vote
1 answer

Run QGIS tool from standalone Python keeps locks on files

I have a Python application that runs some QGIS processing tools. The tools are called in a loop and I am looking to clean up the tool outputs (shapefiles) in between each iteration. I have found ...
Alex Gray's user avatar
1 vote
0 answers

PyQGIS error loading data on second time running a custom made plugin

I have been developing a custom made plugin over the last month and recently I have noticed that when I reload the plugin with plugin reloader the plugin work just fine for the first use. In the ...
JasperB's user avatar
  • 11