<div dir="ltr">Hi Richard<div><br></div><div>On Wed, Feb 4, 2015 at 11:10 PM, Richard Duivenvoorde <span dir="ltr"><<a href="mailto:rdmailings@duif.net" target="_blank">rdmailings@duif.net</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On 04-02-15 17:07, Richard Duivenvoorde wrote:<br>
<br>
> Anybody a clue?<br>
> Trying to attach gdb to the so libs, but failing.<br>
><br>
> It segfaults at the getFeatures() call, as if something wrong with the<br>
> iterator..<br>
<br>
</span>Ah, the original questioner figured out how to save a backtrace:<br>
<br>
<a href="http://pastebin.com/MTqWH2UL" target="_blank">http://pastebin.com/MTqWH2UL</a></blockquote><div><br></div><div>Looks like QApplication instance was not created, so all places where events are needed will fail (e.g. for postgres there is a connection pool which releases connections after some time). Something like this should be added to the top:</div><div><br></div><div>import sys</div><div>app = QApplication(sys.argv)</div><div><br></div><div>Also, at the end of a script it is wise to call QgsApplication.exitQgis() to clean up qgis libraries properly (to avoid crashes on exit). There is a small help for pythonistas from Nathan - a context manager that hides these pieces of code. It can be seen in Tim's post:</div><div><a href="http://kartoza.com/how-to-load-a-qgis-project-in-python/">http://kartoza.com/how-to-load-a-qgis-project-in-python/</a><br></div><div><br></div><div>Cheers</div><div>Martin</div><div><br></div></div></div></div>