[Qgis-user] code running inside QGis, failing outside
PIERRE Sylvain
sylvain.pierre at cg67.fr
Fri Oct 19 04:36:42 PDT 2012
Hello list,
The following code is running perfectly inside Qgis (1.7.2) from the python console :
from PyQt4 import QtCore, QtGui
uri = QgsDataSourceURI()
uri.setDatabase( "C:/APPLI_PDT/CANAL_DEV/bd_canal.sqlite")
uri.setDataSource( "", "AOT_POINT", "GEOMETRY" )
layer = QgsVectorLayer( uri.uri(), "AOT", "spatialite" )
provider = layer.dataProvider()
feat = QgsFeature()
geometry = QgsGeometry()
feat.setAttributeMap({1:QtCore.QVariant(5)})
feat.setGeometry(geometry.fromPoint(QgsPoint(990650,110807)))
(res, outFeats) = provider.addFeatures( [ feat ] )
print str(res)
True
But outside it's failing (in my app build with python, PyQt and PyQgis).
Res is set to false, and no row was insert.
I've spent lots of time with Google, but didn't found anything...
Any help should be welcome.
Sylvain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20121019/d5e13755/attachment.html>
More information about the Qgis-user
mailing list