Problems with the exec bloc

#1

Hello Everybody :grinning:,

I just found a python script to control my new led matrix the MAX7219
The script is working fine but when i tried to launch it with the exec bloc it send the error : command failed

I don't know how to fix that, please can someone help me ?

My flow :

[{"id":"1c52dee0.05af61","type":"change","z":"ed38ec92.4e1d2","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"-c 'rf1(\" & payload & \")'\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":180,"y":320,"wires":[["4be02acf.9e1b2c"]]}]
0 Likes

#2

Not seeing where the exec fits with that flow or what you are invoking ?
What does the second output (stderr) show ?
Do you need -u to unbuffer the output ?

Is this a one off command or does the python app expect more input ? in which case the node-red-node-daemon node may be more appropriate as that takes a continuous stream of commands on stdin.

0 Likes

#3

No it's just a timestamp that will be activate if ireceive a message on my phone;

Here are the 3 output in order :

26/01/2019 à 19:49:37[node: 513f2a71.342e2c](http://192.168.0.18:1880/#)

msg.payload : string[0]

""


26/01/2019 à 19:49:37[node: ff6d8c11.8d04a8](http://192.168.0.18:1880/#)msg.payload : string[186]

"usage: matrix_demo.py [-h] [--cascaded CASCADED]↵ [--block-orientation {0,90,-90}] [--rotate {0,1,2,3}]↵matrix_demo.py: error: unrecognized arguments: 1548528575364↵"



26/01/2019 à 19:49:37[node: f55d01ec.e0cac](http://192.168.0.18:1880/#)msg.payload : Object

object

code: 2

message: "Command failed: python /home/pi/matrix_demo.py 1548528575364↵usage: matrix_demo.py [-h] [--cascaded CASCADED]↵ [--block-orientation {0,90,-90}] [--rotate {0,1,2,3}]↵matrix_demo.py: error: unrecognized arguments: 1548528575364↵" 

I'm sorry i dont know what mean unbuffer, I just need to execut my script not to get an ouptput back.
Ok i will try daemon but can you tell me if my command is right, I have found so many different way to execute a script but no one work with me...

0 Likes

#4

the second of those gives you the error message and the problem you need to fix.

usage: matrix_demo.py [-h] [--cascaded CASCADED]↵ [--block-orientation {0,90,-90}] [--rotate {0,1,2,3}]
matrix_demo.py: error: unrecognized arguments: 1548528575364

You aren't calling the command with the correct arguments... you are just passing it a timestamp

Maybe you don't need the
image

1 Like

#5

Ok I just uncheck the append and it works !
Thank you a lot :kissing_smiling_eyes:

0 Likes