Re: [Qgis-developer] save project via python results in segfault
On Mon, Oct 25, 2010 at 10:07 PM, Martin Dobias wonder...@gmail.com wrote: On Mon, Oct 25, 2010 at 4:13 PM, Richard Duivenvoorde rdmaili...@duif.net wrote: Martin Dobias wrote: Hi Richard On Sun, Oct 24, 2010 at 9:03 PM, Richard Duivenvoorde rdmaili...@duif.net wrote: p=QgsProject.instance() p.setFileName(str(/home/richard/temp/bpprr.qgs)) p.write() I have looked into this and I think I have fixed that issue successfully in r14434. It seems the problem was in not acquiring the python global interpreter lock and thus accessing python API while in an inconsistent state. Richard, Barry, please test whether it helps your plugins. Yup, autosave is now working just fine. Also a simple test of saving a project from the python console works too. Sweeet as. Barry ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] save project via python results in segfault
Martin Dobias wrote: On Mon, Oct 25, 2010 at 4:13 PM, Richard Duivenvoorde rdmaili...@duif.net wrote: Martin Dobias wrote: Hi Richard On Sun, Oct 24, 2010 at 9:03 PM, Richard Duivenvoorde rdmaili...@duif.net wrote: p=QgsProject.instance() p.setFileName(str(/home/richard/temp/bpprr.qgs)) p.write() I have looked into this and I think I have fixed that issue successfully in r14434. It seems the problem was in not acquiring the python global interpreter lock and thus accessing python API while in an inconsistent state. Richard, Barry, please test whether it helps your plugins. Yep Working! Great ... Means you squashed #2870 :-) Thanks Martin! ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] save project via python results in segfault
On Mon, Oct 25, 2010 at 8:44 AM, Barry Rowlingson b.rowling...@lancaster.ac.uk wrote: my autosave plugin has been crashing qgis since version 1.5 because it uses essentially the same python code. I was pretty busy at the time so I just disabled it and carried on. Haven't got back to it, but can confirm the behaviour you are seeing. I notice that the file is being created with zero-length on my system, so the program must be getting into QgsProject:write and crashing there. There's a method for write() with a QFileInfo arg as well as the method with no args. Not sure if this is a problem, but I thought that kind of thing is handled by the SIP wrappers. I tried creating a QFileInfo object in python and calling :write but it still crashed, something like: f = QFileInfo(/tmp/foo.qgs) p = QgsProject.instance() p.write(f) *crash* I need to set up a Qgis build environment to get any further with this... Barry ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] save project via python results in segfault
Hi Richard On Sun, Oct 24, 2010 at 9:03 PM, Richard Duivenvoorde rdmaili...@duif.net wrote: p=QgsProject.instance() p.setFileName(str(/home/richard/temp/bpprr.qgs)) p.write() I've been looking at it by putting debug messages in cpp code, and to me it seems the crash appears when in qgspythonutilsimpl.cpp: 153: the method runString is called with the parameter sys.path.append('/home/richard/temp') I think this kind of crash happens probably always when Python calls C++ and C++ again calls some Python code. I am not sure what exactly happens and whether this is caused by PyQt/sip or python itself... Martin ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] save project via python results in segfault
Martin Dobias wrote: Hi Richard On Sun, Oct 24, 2010 at 9:03 PM, Richard Duivenvoorde rdmaili...@duif.net wrote: p=QgsProject.instance() p.setFileName(str(/home/richard/temp/bpprr.qgs)) p.write() I've been looking at it by putting debug messages in cpp code, and to me it seems the crash appears when in qgspythonutilsimpl.cpp: 153: the method runString is called with the parameter sys.path.append('/home/richard/temp') I think this kind of crash happens probably always when Python calls C++ and C++ again calls some Python code. I am not sure what exactly happens and whether this is caused by PyQt/sip or python itself... ok, then would it be a workaround to add a python qgis-api method for this? Or will we have the same problem then? ( the QgsProject::write()-method emits a 'writeProject'-event which will be received by the python part again. isn't it? ). Otherwise, should we conclude that it is not possible to save a project via python then (and in case of mapserver plugin I would let user NOT use plugin without a saved project in the beginning anyway...)? Richard ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] save project via python results in segfault
On Mon, Oct 25, 2010 at 4:13 PM, Richard Duivenvoorde rdmaili...@duif.net wrote: Martin Dobias wrote: Hi Richard On Sun, Oct 24, 2010 at 9:03 PM, Richard Duivenvoorde rdmaili...@duif.net wrote: p=QgsProject.instance() p.setFileName(str(/home/richard/temp/bpprr.qgs)) p.write() I have looked into this and I think I have fixed that issue successfully in r14434. It seems the problem was in not acquiring the python global interpreter lock and thus accessing python API while in an inconsistent state. Richard, Barry, please test whether it helps your plugins. Regards Martin ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer