mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Add runtime check for sensehat python libs
This commit is contained in:
parent
c3a8a4088d
commit
d17ac7eb2e
@ -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",
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user