Search - User list
Full Version: @pdg_input only returns first input
Root » PDG/TOPs » @pdg_input only returns first input
I'm trying to query my inputs that are coming from a partition sop. I have a partition that has 5 files in it, but when I run @pdg_input in a python expression top it only returns the first input. This seems like a bug to me?

I've tried programmatically getting the inputs, but I can't figure out the syntax to make it work?
@pdg_input is the same as @pdg_input.0, which is also the same as how it works for @attribs in SOPs.

You can use @pdg_input.2 to access the value at index=2, for example. Or, you can use the HScript function pdginput()[ which takes three arguments, one of which is the index: []
Thanks for that clarification. What if I want to get a list of all the inputs, because they are changing so I don't always know how many there are?
In that case, pdginputvals(..) returns the list of all inputs as a space-separated string: []

And, you can also use pdginputsize(..) to get the actual number of input files with a particular tag: []
How do I run those in python?
If you're using Python, you can use the Python API instead of HScript. There's an equivalent function in Python for all of the things available in HScript, for example: []

So for example from a Python parameter expression, you can use pdg.workItem().inputFilesForTag("file") to get a list of all input files, or pdg.workItem().inputFilesForTag("file/image") for all input image files.

If you're using a Python Script node, which already has the work item stored to a work_item local variable, you can use: work_item.inputFilesForTag("file").
Amazing, that works perfectly. Thank you!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB