mik74 Posted September 17, 2020 Share Posted September 17, 2020 Hello, I would like to fetch files using python into work items. I have an array of file paths and I want to create a work item per file basically to process them. Same way as the “filepattern” top but with python processor. I can not find the python way to do that. Thank you guys Quote Link to comment Share on other sites More sharing options...
Alain2131 Posted September 21, 2020 Share Posted September 21, 2020 (edited) Hi Mikel, I believe this question should be posted in the Scripting Forum But here's how I would do it Inside a Python Processor, from os import listdir path = r"C:\someFolder" allFiles = listdir(path) for file in allFiles: newItem = item_holder.addWorkItem() newItem.setStringAttrib("file", file) newItem.setStringAttrib("path", path + "\\" + file) Basically, using this documentation page, you can see how to add a work item This tells you that the resulting object is → pdg.WorkItem If you follow it to its documentation page, there you can see how to add an attribute to said work item Edited September 21, 2020 by Alain2131 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.