Error Passing custom Datatypes as Flow variable into python nodes


#1

Hi,
I ran into an issue passing custom datatype flow variables from one python node into another. I have a web Client Object that is authenticated with Credentials and I need to reuse this in multiple places in my pipeline.

When I add it to the flow variables in turns into a ‘string’ and I cannot use it further. Any ideas how I can maintain the Datatype while passing flow variables.

Any help appreciated.

Thanks !

Mohammed Ayub


#2

Hi Mohammed,

The Python nodes support flow variables of types double, integer, and string. If you want to pass more complex objects around, you’ll need to use a Python scripting node that features an object port (Python Object Reader, Python Object Writer, Python Predictor, and Python Learner). Unfortunately, none of these nodes have both input and output ports for both data and objects. Also, they only work for objects that can be pickled.

If that doesn’t work for you, you could also try to manually save the object to a workflow relative location in one node (e.g., using pickling if that’s possible), pass the file location of the saved object as a flow variable to the next Python node and manually load it there, again.
You can get the workflow location via the Extract Context Properties node (property context.workflow.absolute-path) and pass it to your first Python node as a flow variable.

Marcel