我认为您的问题可以使用独立脚本和-功能来解决stream.findAll()
。
你可以这样做:
from os import listdir
from os.path import isfile, join
session = modeler.script.session()
tasks = session.getTaskRunner()
mypath = 'C:\\yourpath'
streams = [f for f in listdir(mypath) if (isfile(join(mypath, f)) and f.endswith(".str"))]
for streamFile in streams:
print(stream.getName()+" is getting processed.")
stream = tasks.openStreamFromFile(demosDir + streamFile, True)
inputNodes = stream.findAll("excelimport", None)
for in in inputNodes:
ff = in.getPropertyValue("full_filename")
ff.replace("2017Q3.xlsx", "2017Q4.xlsx")
in.setPropertyValue("full_filename", ff)
print(stream.getName()+" is processed.")
stream.close()
我没有对此进行测试,但它不需要进行大量调整即可工作。