fixed check for python2 module while using python3 (#866)

Excellent - thank for that.
This commit is contained in:
mw75 2021-12-12 18:05:13 +01:00 committed by GitHub
parent 68ba586074
commit 70ac42463c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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;
}