diff --git a/hardware/sensehat/package.json b/hardware/sensehat/package.json index 4e470d9a..36be22be 100644 --- a/hardware/sensehat/package.json +++ b/hardware/sensehat/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pi-sense-hat", - "version" : "0.0.8", + "version" : "0.0.9", "description" : "A Node-RED node to interact with a Raspberry Pi Sense HAT", "repository" : { "type":"git", diff --git a/hardware/sensehat/sensehat.js b/hardware/sensehat/sensehat.js index eee0b8a5..d437ddb4 100644 --- a/hardware/sensehat/sensehat.js +++ b/hardware/sensehat/sensehat.js @@ -22,9 +22,12 @@ module.exports = function(RED) { var hatCommand = __dirname+'/sensehat'; - if ( !(1 & parseInt ((fs.statSync(hatCommand).mode & parseInt ("777", 8)).toString (8)[0]) )) { - RED.log.error(hatCommand + " command is not executable"); - throw "Error : "+RED._("node-red:rpi-gpio.errors.mustbeexecutable"); + if (!fs.existsSync('/usr/lib/python2.7/dist-packages/sense_hat')) { + throw "Error: Can't find Sense HAT python libraries. Run sudo apt-get install sense-hat"; + } + + if ( !(1 & parseInt((fs.statSync(hatCommand).mode & parseInt ("777", 8)).toString(8)[0]) )) { + throw "Error: "+RED._("node-red:rpi-gpio.errors.mustbeexecutable"); } // the magic to make python print stuff immediately