Issue Exec Node

#1

Hi!
I am using an Exec node to run a python script, this python script has a while that doesn't stop (This while get data from a car), but node-red doens't show data before the loop are finish o/

I am using the option: "while the command is running - spawn mode". I can't use the option: "while the command is complete - exec mode", because it will cause loss of performance.

How can I get data in Node-RED every time the loop runs without having to wait the loop stops (Loop cannot stop)?

0 Likes

#2

Did you read the info box that specifically mentions -u option for not buffering python commands ?

1 Like

#3

Yeahh, but it didn't work for me :confused:

Maybe I am doing it wrong:

0 Likes

#4

Are you passing -u to your app ? Or the python process ? Looks like the app to me

1 Like

#5

How can I pass -u to a python process? Sorry, I don't know this :confused:

0 Likes

#6

Ok, now it is solved ^^.
In my python script I use:
print('RPM',rpmi[0:-23], flush = True)

This is a way to do it: "flush = True", but, now I want to know how to use this "-u" thing, you can teach me?

0 Likes

#7

Put the -u after python3 rather that add it to the end

python3 -u yourapp.py
1 Like

#8

Ohhh loord, thank you @dceejay !

0 Likes