[QGIS-Developer] writeAsVectorFormatV2 fails in loop

Bourdon, Jean-François (DIF) Jean-Francois.Bourdon at mffp.gouv.qc.ca
Mon Aug 3 07:42:56 PDT 2020


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
jean-francois.bourdon at mffp.gouv.qc.ca
mffp.gouv.qc.ca<http://www.mffp.gouv.qc.ca/accueil.jsp>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200803/3f50b518/attachment.html>


More information about the QGIS-Developer mailing list