Bug report #20261

python script crashes QGIS

Added by Theresa Lichtenberger over 4 years ago. Updated over 4 years ago.

Category:PyQGIS Console
Affected QGIS version:2.18.17 Regression?:No
Operating System:Windows10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:Yes Copied to github as #:28082


I have written a python script which has two input vector layers (one point-layer and one line-layer). The outpout is another line-layer. But when I try too set the geometry for the new edge, the python script stopps and I get the error "minidump written to C".

Here is my python script code:


With the help of printf-Debugging, I have figured out that the crash is caused by this line:

-> newEdge.setGeometry(QgsGeometry.fromPolyline([geomFrom.asPoint(),geomTo.asPoint()]))

I have already deleted the .qgis2-folder and started qgis 2.18 anew. But without success.

Any suggestions?

merge_edges.py Magnifier - python script file (5 KB) Theresa Lichtenberger, 2018-10-29 03:06 PM


#1 Updated by Giovanni Manghi over 4 years ago

  • Subject changed from QGIS python script crashed with minidump written to C to python script crashes QGIS

#2 Updated by Nyall Dawson over 4 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

This is fixed in QGIS 3.0

In 2.x it's necessary to make an explicit copy of all geometries you capture from features, e.g.

geomFrom = QgsGeometry(feat2.geometry())

Also available in: Atom PDF