Execute node giving error 1 on including import cv2 in python file

Running a python file (using exec node) which consists of importing cv2 library gives error 1. Running same file without the 'import cv2' command gives a correct output on node-red. Do note that the python file is running correctly when command is used directly on command prompt. Device used: Raspberry pi 4

What OS/hardware are you running on?

Is it a Docker install of node-red. If so then it may be that the library is not available in the docker container.

Otherwise possibly it is a path problem. When you run in an exec mode you do not get the PATH settings that you get when you logon. I don't know what paths python needs though (and it probably depends on what OS you are running) so you may need to do some research or hope someone here can help.

Also add debug nodes to all the outputs of the exec node, set them to output Complete Message and check whether there is additional information in any of the messages.

Appreciate your help Colin

Running on raspberry pi 4 with raspbian
Not using docker install

Concerning the path the file path is right as the file runs when i remove the ‘import library’ line from the script, so you are suggesting that i may have to input the full python path also?

It was indeed the python command not right, even with python 3 set as default, it was commanding usage of python 3

So i updated command to use ‘python3’ instead of ‘python’

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