QGIS 3 python通过层循环并运行算法

QGIS 3 python通过层循环并运行算法,python,gis,qgis,Python,Gis,Qgis,我试图在各层之间循环,并在每层上运行一个处理算法,但输入出错: 代码 feedback = QgsProcessingFeedback() # Get current layers layers = QgsProject.instance().mapLayers().values() # Loop through layer and run algorithm for layer in layers: processing.run("qgis:pointstopath", {'INP

我试图在各层之间循环,并在每层上运行一个处理算法,但输入出错:

代码

feedback = QgsProcessingFeedback()

# Get current layers
layers = QgsProject.instance().mapLayers().values()

# Loop through layer and run algorithm
for layer in layers:
    processing.run("qgis:pointstopath", {'INPUT': layer, 'ORDER_FIELD': 'name', 'GROUP_FIELD': 'name','OUTPUT': layer+'.gpkg'},feedback)
错误

Traceback (most recent call last):
File "C:\OSGEO4~1\apps\Python37\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 2, in <module>
File "C:/OSGEO4~1/apps/qgis-rel- 
dev/./python/plugins\processing\tools\general.py", line 105, in run
return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback,
context)
File "C:/OSGEO4~1/apps/qgis-rel- 
dev/./python/plugins\processing\core\Processing.py", line 183, in 
runAlgorithm
raise QgsProcessingException(msg)
_core.QgsProcessingException: There were errors executing the algorithm.
回溯(最近一次呼叫最后一次):
文件“C:\OSGEO4~1\apps\Python37\lib\code.py”,第90行,运行代码
exec(代码,self.locals)
文件“”,第2行,在
文件“C:/OSGEO4~1/apps/qgis rel-
dev//python/plugins\processing\tools\general.py”,第105行,运行中
返回处理.runAlgorithm(algOrName、参数、onFinish、反馈、,
(上下文)
文件“C:/OSGEO4~1/apps/qgis rel-
dev//python/plugins\processing\core\processing.py”,第183行,在
运行算法
引发QgsProcessingException(msg)
_core.QgsProcessingException:执行算法时出错。
如何正确解析从映射到算法的输入层