From 4f87ebdf0a3e20f14559fa6a87b888091ca37454 Mon Sep 17 00:00:00 2001 From: Nephiel Date: Wed, 24 Oct 2018 00:20:44 +0200 Subject: [PATCH] Recognize pip installs of RPi.GPIO (#1934) Fixes "[warn] rpi-gpio : Cannot find Pi RPi.GPIO python library" when it is installed with pip using the default prefix (/usr/local). --- nodes/core/hardware/36-rpi-gpio.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nodes/core/hardware/36-rpi-gpio.js b/nodes/core/hardware/36-rpi-gpio.js index 0a21f578a..9afcd40dd 100644 --- a/nodes/core/hardware/36-rpi-gpio.js +++ b/nodes/core/hardware/36-rpi-gpio.js @@ -24,8 +24,12 @@ module.exports = function(RED) { try { fs.statSync("/usr/lib/python2.7/dist-packages/RPi/GPIO"); // test on Hypriot } catch(err) { - RED.log.warn("rpi-gpio : "+RED._("rpi-gpio.errors.libnotfound")); - allOK = false; + try { + fs.statSync("/usr/local/lib/python2.7/dist-packages/RPi/GPIO"); // installed with pip + } catch(err) { + RED.log.warn("rpi-gpio : "+RED._("rpi-gpio.errors.libnotfound")); + allOK = false; + } } } }