I'm a beginner on both JS and Python, so I can't get too deep into the weeds on the script side. Hopefully I can provide enough context so that my question makes sense.
I am trying to run a single pass python script (ReadObjectList.py from the Bacpypes library) that requires two arguments to execute. This is using the python shell node.
I can manually run the command on the host (Alpine Linux) with
#python ReadObjectList.py <device_id> <device_addr>
(both values entered with no punctuation, separated by a single space).
It works perfectly from the host CLI.
In Node-Red, I can't find a way to satisfy both arguments, as the script is expecting an integer for the ID and a string for the address.
If I send both arguments as a single string, the script doesn't accept it and errors out on invalid integer for device_id.
If I inject the ID as a number type, it skips past that error and of course comes back with an error for missing the address.
From what I've gathered, the value of msg.payload can't be of mixed types.
I've tried breaking the message up into an array, which does allow the two values to exist as different types, but if I inject that array into the python shell node, it errors out for both required arguments being missing and spits back the array as a string (square brackets included).
Does anyone know of a workaround or trick that would let me pass those two arguments on invoking the script? I'm not opposed to an exec node either, but it seems that the mixed data types is going to be an issue either way.
The python shell seems to work well with other scripts that take either a single argument or listen for console commands that can be injected in the msg.payload.
Thanks for reading!