|On this page|
This node creates work items that run a Python script during the work item generation phase, in process or as a scheduled job. The behavior is configured using the Evaluate Script During menu parameter.
If the script is configured to run during the generation step the code is evaluated immediately after the work item is created. No additional work is done while the work item is cooking. You can use this mode to create attributes programatically, instead of using an Attribute Create node.
Otherwise, if one of the other evaluation modes is selected, the work item evaluates the script code when it cooks. In-process scripts can access a larger amount of information about the PDG graph, as well as other objects and settings within the current Houdini session. If the script is run out of process it is limited to accessing the attributes of the work item it is associated with, and anything the script can import itself.
The node will always created exactly one work item per upstream item, with the Python Code field as the work to be done for that item. To generate custom work item configuration, the Python Processor node should be used instead.
Work Item Generation
Whether this node generates static or dynamic work items. You should generally leave this set to "Automatic" unless you know the node’s work items can be computed statically, or that they need to be generated dynamically.
This node always creates dynamic work items: it waits until the upstream work items are known, and generates new work items from the upstream work items.
This node always creates static work items: it creates the number of work items it thinks it needs based on the parameters (and any upstream static items) before the network runs.
If the input is static (a static processor, or a partitioner with only static inputs, or a mapper), this node generates static work items, otherwise it generates dynamic work items.
Evaluate Script During
Determines when the script code stored on this node is evaluated. The script can be execute during the cook stage, either out of process by a scheduler or in the same process as the Houdini session. Alternatively, the script can be run when the work item is generating.
Copy Inputs to Outputs
When this option is enabled, the Python Script node will automatically copy input files to its output file list. This is useful if you don’t plan to add any new output files in your script, and want to pass the same inputs to the downstream node.
The following parameters configure which Python executable to use to run the script code and what arguments to pass to the executable. They're only available when the node is configured to run out of process, by setting the Evaluate Script During option to Cook (Out-of-Process).
When running out of process, this parameter determines which Python executable to use to run the script.
Custom Python Bin
When Python Bin is set to Custom this parameter is evaluated to determine the path to the Python executable.
Extra arguments passed to the Python executable itself to configure the behavior of the interpreter.
Arguments passed to the Python script. These values are accessible in the
Reset Python Path Variables
When this toggle is enabled the PYTHONHOME and PYTHONPATH variables defined by Houdini are reset in the external Python process. This is necessary when using a Python version that is incompatible with the one built into Houdini.
The Python code that is run for each work item.
When running out of process, the code is saved to disk an executed using the
specified Python interpreter. The script has access to the
variable which provides an API to access the name, index, frame and
attributes of the work item associated with the script. Additionally, the
strData helper functions can be used to
query attributes on the work item.
When running in-process or during the generation stage, the script is run
using the Python interpreter embedded in Houdini. In addition to the
work_item variable, the
parent_item variables are also
available. The former is a reference to the node that owns the work item,
parent_item variable is a reference to the parent or
TOP Scheduler Override
This parameter overrides the TOP scheduler for this node.
Work Item Priority
This parameter determines how the current scheduler prioritizes the work items in this node.
Inherit From Upstream Item
The work items inherit their priority from their parent items. If a work item has no parent, its priority is set to 0.
The work item priority is set to the value of Priority Expression.
Node Defines Priority
This parameter is only available when Work Item Priority is set to Custom Expression.
This parameter specifies an expression for work item priority. The expression is evaluated for each work item in the node.