Update. Using the deprecated QgsVectorFileWriter.writeAsVectorFormat() instead 
of QgsVectorFileWriter.writeAsVectorFormatV2() solves the issue. So I suppose 
there is a bug somewhere in the new implementation.

Jean-François Bourdon, ing.f.
Analyste en télédétection
Direction des inventaires forestiers
Ministère des Forêts, de la Faune et des Parcs
5700, 4e Avenue Ouest, local A-108
Québec (Québec) G1H 6R1
Téléphone : 418 627-8669, poste 4304
[email protected]
mffp.gouv.qc.ca<http://www.mffp.gouv.qc.ca/accueil.jsp>

De : QGIS-Developer [mailto:[email protected]] De la part 
de Bourdon, Jean-François (DIF)
Envoyé : 3 août 2020 10:43
À : [email protected]
Objet : [QGIS-Developer] writeAsVectorFormatV2 fails in loop

Hi all,

I have strange a bug when using QgsVectorFileWriter.writeAsVectorFormatV2() 
inside a lengthy loop (30 minutes between each cycle). The first run inside the 
loop goes well but it crashes at the second run when trying to write a GPKG 
with the error below:

options.driverName = "GPKG"
RuntimeError: wrapped C/C++ object of type SaveVectorOptions has been deleted

I tried with a much shorter loop and it has no problem at all writing the GPKG 
at each cycle. I'll try with the now deprecated 
QgsVectorFileWriter.writeAsVectorFormat() to see if it makes any differences. 
Any idea why it could happen? By the way, I'm defining   options = 
QgsVectorFileWriter.SaveVectorOptions()   just before   options.driverName = 
"GPKG"  each time.

Thanks

Jean-François Bourdon, ing.f.
Analyste en télédétection
Direction des inventaires forestiers
Ministère des Forêts, de la Faune et des Parcs
5700, 4e Avenue Ouest, local A-108
Québec (Québec) G1H 6R1
Téléphone : 418 627-8669, poste 4304
[email protected]<mailto:[email protected]>
mffp.gouv.qc.ca<http://www.mffp.gouv.qc.ca/accueil.jsp>

_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to