Python script in node red

Trying to run a python script from inside node red. Downloaded a couple of nodes but they don't seem to do what I need
The script I have runs fine from the command line but needs to start using sudo. I am assuming that the sudo command needs to run from within node red but in these two nodes I have been unable to figure out how to insert the command with sudo. WIthout sudo the command fails but with the sudo command I get a node red error. exit code 1, traceback and a lot more.
I may be missing the obvious, ok , probably missing the obvious

  1. does the user running NR have SUDO privilege?
  2. have you tried using the exec node?
  3. what platform are you running on?

the NR user does not have sudo rights. Have not tried the exec node, but will. This is on a Pi 3 running Raspbian with the latest updates to node red.

So..... the exec node does work but is there any way to get feedback from the script? I have several print commands that I would like to see that report back to me.

Did you put debug nodes (set to display the complete msg object) on each of the three outputs of the node to see what you would get.

If you are running on a Pi wth the default 'Pi' user, it should have sudo authority....

Did put a debug node on each output, set to complete, nothing on any of them. Yes, running on a Pi with default user so apparently that does have sudo authority.
but I do get a PID number at the bottom of the node so I am assuming it's running

Look at the options in the Output field in the exec node.

tried both options in output with no results from either setting

ok, did the stupid thing and didn't deploy after changing the settings. got output now,
Thanks to all

1 Like