In my script I'm trying to save some vector layer after processing it. In the rest of the script it works fine but in this section (after the if condition) I keep getting an error, no matter in which processing part I'm trying to save it. I tried to run this section in the console and it works just fine, but within the script there is something wrong and I cant find the solution. Any ideas / work arounds maybe?
Could not create layer S:\BER\GIS_Daten\Methodenentwicklung\Vogelschutzmodell\Dichtezentren_Ordner\dichtezentren_v_00_00_02\02_zwischen\220704_2204_dichtezentren\02_ergebnisse\Prüfbereiche_2\union_delete_id\Nahbereich_Kornweihe.gpkg: Creation of data source failed (OGR error: sqlite3_open(S:\BER\GIS_Daten\Methodenentwicklung\Vogelschutzmodell\Dichtezentren_Ordner\dichtezentren_v_00_00_02\02_zwischen\220704_2204_dichtezentren\02_ergebnisse\Prüfbereiche_2\union_delete_id\Nahbereich_Kornweihe.gpkg) failed: unable to open database file)
Blockquote
if feats_count > 1:
union = processing.run("native:union", {
'INPUT':prueflayer,
'OVERLAY':None,
'OVERLAY_FIELDS_PREFIX':'',
'OUTPUT':'TEMPORARY_OUTPUT'})
#'OUTPUT': union_art_ordner + '\\' + 'union_' + shapefileshortname})
feedback.setProgressText('----------------------------------------------------------------------------------------------------------------------------------------------------------------------------')
randompoints_union_expr=' '.join(('union',str(prueflayer),'.'))
feedback.setProgressText(randompoints_union_expr)
union_delete_geom = processing.run("native:deleteduplicategeometries", {
'INPUT': union ['OUTPUT'],
'OUTPUT':'TEMPORARY_OUTPUT'})
#'OUTPUT': union_delete_id_art_ordner + '\\' + 'union_single_id' + shapefileshortname})
union_single_id = processing.run("qgis:fieldcalculator", {
'INPUT': union_delete_geom ['OUTPUT'],
'FIELD_NAME': 'unique_id',
'FIELD_TYPE': 2,
'FIELD_LENGTH': 80,
'FIELD_PRECISION': 3,
'NEW_FIELD': True,
'FORMULA': ' $id ',
'OUTPUT': union_delete_id_art_ordner + '\\' + 'union_delete_id' + '\\' + shapefileshortname})
else:
pass
enter code here