[QGIS-Developer] createvectorTable error: Could not retrieve driver for connection

Raymond Nijssen r.nijssen at terglobo.nl
Fri Dec 2 03:30:23 PST 2022


No one having a clue? Should I create an issue?

Raymond


On 30-11-2022 18:08, Raymond Nijssen via QGIS-Developer wrote:
> Hi developers,
> 
> Recently some users of my plugin started getting errors in the code that 
> creates a .gpkg file with a table. I wrote a piece of test code:
> 
> gpkg_fn = '/home/raymond/tmp/test.gpkg'
> md = QgsProviderRegistry.instance().providerMetadata('ogr')
> conn = md.createConnection(gpkg_fn, {})
> fields = QgsFields()
> fields.append(QgsField('key', QVariant.String))
> fields.append(QgsField('value', QVariant.String))
> conn.createVectorTable('', 'test', fields, QgsWkbTypes.NoGeometry, 
> QgsCoordinateReferenceSystem(), True, {})
> 
> 
> That last line *sometimes* results in this error:
> 
> _core.QgsProviderConnectionException: Could not retrieve driver for 
> connection
> 
> 
> 
> I cannot reproduce the error on my laptop (Linux), but Richard tried a 
> few QGIS versions in both Windows and Linux and *sometimes* got the 
> error and sometimes not. Even in the same application, the error 
> disappeared after running another version of QGIS simultaneously... :/
> 
> No clue if this error is GDAL or Qt or whatever related, pretty puzzling 
> for me. Hope anyone can help!
> 
> Kind regards,
> Raymond
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list