User avatar
Batmitesg
Posts: 4
Joined: Tue Jun 05, 2018 1:03 am

[SOLVED]Node-RED nrpgio python command not running - Python3 Incompatibility ?

Thu Jun 28, 2018 4:02 am

Hi,

I am trying to use Node-RED to play with the GPIO of a RPi 3B, I have no problem with most of the standard nodes or some others like, dashboard, and MQTT, but I can't get the GPIO to work.

I am trying the basic example from Node-RED website here https://nodered.org/docs/hardware/raspberrypi First Flow Blink GPIO.

I am getting this message from Node-Red.

Code: Select all

28 Jun 11:56:51 - [error] [rpi-gpio out:d973b857.4795f8] nrpgio python command not running
Edit : Linked to another issue I was having with apt-get update, I change to Python2.7 as default and the issue is gone. But as soon as I put back Pyhton3.5 it reappears.
Is there a way to fix this ?

Here is my flow when Python3.5 is my alternative:
Image
You can see below the GPIO items "Not running" & "Stopped" which are abnormal :|

And here is my flow with Python2.7 as my alternative:
Image
Here everything is fine.

This is the code of the flow.

Code: Select all

[{"id":"223e823a.1456fe","type":"function","z":"e43be549.504218","name":"Toggle 0/1 on input","func":"\ncontext.state = context.state || 0;\n\n(context.state == 0) ? context.state = 1 : context.state = 0;\nmsg.payload = context.state;\n\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":80,"wires":[["4d4592d1.0e83dc","d973b857.4795f8"]]},{"id":"4d4592d1.0e83dc","type":"debug","z":"e43be549.504218","name":"Output Pin","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":569,"y":140.00000095367432,"wires":[]},{"id":"f6394d69.8e652","type":"inject","z":"e43be549.504218","name":"tick every 3 sec","topic":"","payload":"","payloadType":"date","repeat":"3","crontab":"","once":false,"onceDelay":"","x":129,"y":80.00000095367432,"wires":[["223e823a.1456fe"]]},{"id":"d973b857.4795f8","type":"rpi-gpio out","z":"e43be549.504218","name":"","pin":"11","set":true,"level":"0","freq":"","out":"out","x":576.8333625793457,"y":79.83333396911621,"wires":[]},{"id":"f15a0880.c4b898","type":"rpi-gpio in","z":"e43be549.504218","name":"","pin":"7","intype":"up","debounce":"25","read":false,"x":80,"y":200,"wires":[["bfa14b82.e52128"]]},{"id":"bfa14b82.e52128","type":"function","z":"e43be549.504218","name":"Toggle 0/1 on input","func":"\ncontext.state = context.state || 0;\n\n(context.state == 0) ? context.state = 1 : context.state = 0;\nmsg.payload = context.state;\n\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":200,"wires":[["e9d3bac6.57e408"]]},{"id":"e9d3bac6.57e408","type":"debug","z":"e43be549.504218","name":"Input Pin","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":550,"y":200,"wires":[]}]
So it's clearly pointing in the direction of Python3.5, but that's all I can sat for now. Some help would be great.
Last edited by Batmitesg on Mon Jul 09, 2018 9:44 am, edited 1 time in total.

DirkS
Posts: 10369
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Node-RED nrpgio python command not running - Python3 Incompatibility ?

Mon Jul 02, 2018 4:29 pm

Batmitesg wrote: Edit : Linked to another issue I was having with apt-get update, I change to Python2.7 as default and the issue is gone. But as soon as I put back Pyhton3.5 it reappears.
Is there a way to fix this ?
Apparently it's not yet compatible with Python 3.
See the source (I think it is the correct source) at https://github.com/node-red/node-red/bl ... pio.py#L27

User avatar
Batmitesg
Posts: 4
Joined: Tue Jun 05, 2018 1:03 am

Re: Node-RED nrpgio python command not running - Python3 Incompatibility ?

Mon Jul 09, 2018 1:04 am

DirkS wrote:
Mon Jul 02, 2018 4:29 pm
Apparently it's not yet compatible with Python 3.
See the source (I think it is the correct source) at https://github.com/node-red/node-red/bl ... pio.py#L27
;) Thanks DirkS, it explains why this fix is working.

I will keep doing this and changing my Python version whenever necessary or use shebang lines to force to a certain version if needed.

Return to “Troubleshooting”