Nodered exec node python error 127 on OpenWrt

I have nodered on OpenWRT and have configured exec node to exexute a python code. python /path/xxx.py. The path is correct. The command works fine on CLI. But from nodered exec node throws an error 127, /bin/sh: python not found. Please advise what is the solution?

Probably you need to use the proper shebang or export/specify the PATH environment variable:

Command 'which python' revealed /usr/python/bin/python and I put this on top in the python file #!/usr/python/bin/python but it is still doing the same error127.

Also tried all sort of shebang just to try my luck:-
#!/usr/bin/env python2, #!/usr/bin/env python3, #!/usr/python/bin/python/env python2, #!/usr/python/bin/python/env python2

It works when I use terminal every time python /path/xxx.py, but it always throws error127 while using nodered exec node:

image

Any suggestions please

enlarge the picture :wink:

Here is the enlarged picture.

Make sure to install:

Bingo, path to PYTHONHOME , PYTHONPATH and LD_LIBRARY_PATH needed to be added to the OpenWRT node_red daemon. Upon stop and start, the exec node command on nodered worked perfectly.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.