[Qgis-user] PyQGIS script segfaults with 2.12

Tommy Chang tommy.y.chang at gmail.com
Thu Oct 29 08:13:10 PDT 2015


Hi, just to report that the following works for me:

from qgis.core import *
QgsApplication.setPrefixPath('/usr')
app = QgsApplication(sys.argv, True)
app.initQgis()
...
app.exec_()
app.deleteLater()

On Wed, Oct 28, 2015 at 8:10 AM, Luigi Pirelli <luipir at gmail.com> wrote:

> thank you DelazJ... I didn't remember where i read it
>
> regards
> Luigi Pirelli
>
>
> **************************************************************************************************
> * LinkedIn: https://www.linkedin.com/in/luigipirelli
> * Elance: https://www.elance.com/s/edit/luigipirelli/
> * GitHub: https://github.com/luipir
> * Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
> * Mastering QGIS:
> https://www.packtpub.com/application-development/mastering-qgis
>
> **************************************************************************************************
>
>
> On 28 October 2015 at 10:40, DelazJ <delazj at gmail.com> wrote:
> > Hi,
> > It's discussed in this bug report : http://hub.qgis.org/issues/13494
> >
> > 2015-10-28 10:21 GMT+01:00 Luigi Pirelli <luipir at gmail.com>:
> >>
> >> I suppose QtGui.QApplication(sys.argv) would be before the
> >> initQgis().... new Auth system need a QApplication to work.
> >>
> >> I can't remember where there were a Larry Shaffer post regarding
> >> this... I can't find it now. Please ttest and give confirmation in the
> >> list.
> >>
> >> regards
> >> Luigi Pirelli
> >>
> >>
> >>
> **************************************************************************************************
> >> * LinkedIn: https://www.linkedin.com/in/luigipirelli
> >> * Elance: https://www.elance.com/s/edit/luigipirelli/
> >> * GitHub: https://github.com/luipir
> >> * Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
> >> * Mastering QGIS:
> >> https://www.packtpub.com/application-development/mastering-qgis
> >>
> >>
> **************************************************************************************************
> >>
> >>
> >> On 28 October 2015 at 10:01, Alessandro Pasotti <apasotti at gmail.com>
> >> wrote:
> >> > 2015-10-28 9:57 GMT+01:00 François-Xavier Thomas
> >> > <francois-xavier.thomas at airinov.fr>:
> >> >>
> >> >> Hello all,
> >> >>
> >> >> I've just upgraded to QGIS 2.12, in order to test some of my scripts
> >> >> with
> >> >> the new version, and they just happen to segfault immediately when I
> >> >> call
> >> >> QgsApplication.initQgis() in 2.12.
> >> >>
> >> >> I've checked the latest docs[1], and the 3 lines mentioned at the
> >> >> beginning are enough to crash the Python interpreter:
> >> >>
> >> >>   from qgis.core import *
> >> >>   QgsApplication.setPrefixPath("/usr", True)
> >> >>   QgsApplication.initQgis()
> >> >>
> >> >
> >> > Try to add QtGui.QApplication(sys.argv) such as:
> >> >
> >> > #Initialize QGIS
> >> > core.QgsApplication.setPrefixPath("/usr", True)
> >> > core.QgsApplication.initQgis()
> >> > # On 2.10 crashes without!
> >> > QtGui.QApplication(sys.argv)
> >> >
> >> >
> >> > I thought it was fixed in 2.12 (and master).
> >> >
> >> >
> >> > --
> >> > Alessandro Pasotti
> >> > w3:   www.itopen.it
> >> >
> >> > _______________________________________________
> >> > Qgis-user mailing list
> >> > Qgis-user at lists.osgeo.org
> >> > http://lists.osgeo.org/mailman/listinfo/qgis-user
> >> _______________________________________________
> >> Qgis-user mailing list
> >> Qgis-user at lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/qgis-user
> >
> >
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20151029/6b169245/attachment.html>


More information about the Qgis-user mailing list