I want to export my polygon with this file name : yyyymmdd_PVD.gpkg
from qgis import processing
import datetime
dir = 'C:/Users/CMCA/Downloads/'+ str(datetime.datetime.now())+'.gpkg'
processing.run("native:savefeatures",
{'INPUT':iface.activeLayer(),
'OUTPUT':dir,
'LAYER_NAME':'test',
'DATASOURCE_OPTIONS':'',
'LAYER_OPTIONS':''})
Error:
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "<string>", line 61, in <module>
File "C:\PROGRA~1/QGIS32~1.0/apps/qgis/./python/plugins\processing\tools\general.py", line 108, in run
return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
File "C:\PROGRA~1/QGIS32~1.0/apps/qgis/./python/plugins\processing\core\Processing.py", line 187, in runAlgorithm
ret, results = execute(alg, parameters, context, feedback, catch_exceptions=False)
File "C:\PROGRA~1/QGIS32~1.0/apps/qgis/./python/plugins\processing\gui\AlgorithmExecutor.py", line 72, in execute
results, ok = alg.run(parameters, context, feedback, {}, False)
_core.QgsProcessingException: Could not create layer C:/Users/CMCA/Downloads/2023-03-21 17:19:46.771813.gpkg: Unable to load C:/Users/CMCA/Downloads/2023-03-21 17 provider