From 70ac42463c19d9c7b05e43ea200def919e45cd6b Mon Sep 17 00:00:00 2001 From: mw75 Date: Sun, 12 Dec 2021 18:05:13 +0100 Subject: [PATCH] fixed check for python2 module while using python3 (#866) Excellent - thank for that. --- hardware/neopixel/neopix | 6 +++++- hardware/neopixel/neopixel.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hardware/neopixel/neopix b/hardware/neopixel/neopix index e135bbd69..3e1609cb6 100755 --- a/hardware/neopixel/neopix +++ b/hardware/neopixel/neopix @@ -4,4 +4,8 @@ python_cmd='python3' command -v python3 > /dev/null || python_cmd=`python` BASEDIR=$(dirname $0) -sudo $python_cmd -u $BASEDIR/neopix.py $@ +if [ "$1" == "check" ];then + $python_cmd -c "import rpi_ws281x" +else + sudo $python_cmd -u $BASEDIR/neopix.py $@ +fi diff --git a/hardware/neopixel/neopixel.js b/hardware/neopixel/neopixel.js index 12214b331..fc5c6c513 100644 --- a/hardware/neopixel/neopixel.js +++ b/hardware/neopixel/neopixel.js @@ -14,7 +14,7 @@ module.exports = function(RED) { RED.log.warn("rpi-neopixels : "+RED._("node-red:rpi-gpio.errors.ignorenode")); allOK = false; } - else if (execSync('python -c "import rpi_ws281x"').toString() !== "") { + else if (execSync(piCommand+" check").toString() !== "") { RED.log.warn("rpi-neopixels : Can't find neopixel python library"); allOK = false; }