# No output from node - Why?

**URL:** <https://discourse.nodered.org/t/no-output-from-node-why/49642>\
**Category:** General\
**Created:** [12 August 2021 08:21 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642 "2021-08-12T08:21:07Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![FeliceM](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@FeliceM](https://discourse.nodered.org/u/FeliceM)\
**Post date:** [12 August 2021 08:21 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/1 "2021-08-12T08:21:07Z")

</div>

I am not sure about the reasons for this issue. I had some error in the flow caused by a node which was not installed. I resolved that and restarted nodered.  
Now, all my flows which have been working without issues for months are not giving any output.  
I do not see errors of any type. The exec node has a PID. The script is working. I don't know what to look for. If I create a simple inject/debug node, it is working but all my proven working nodes do not give output.  
Here is one of the nodes not giving output (just a temperature probe).

```auto
[{"id":"f20693fd.b834c","type":"inject","z":"4e4990f3.d4ada","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":540,"wires":[["af021ac0.286e18"]]},{"id":"1eeb94bf.26d04b","type":"debug","z":"4e4990f3.d4ada","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":500,"wires":[]},{"id":"af021ac0.286e18","type":"exec","z":"4e4990f3.d4ada","command":" bash /home/pi/Develop/Temp/Temperature.sh","addpay":"","append":"","useSpawn":"true","timer":"","oldrc":false,"name":"Command Temperature","x":370,"y":540,"wires":[["2473ff7.e3f4d"],[],[]]},{"id":"563647d0.68ebd8","type":"influxdb out","z":"4e4990f3.d4ada","influxdb":"b87cafc6.11924","name":"Temp-Influx","measurement":"temperature","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"organisation","bucket":"bucket","x":750,"y":580,"wires":[]},{"id":"2473ff7.e3f4d","type":"function","z":"4e4990f3.d4ada","name":"","func":"var t=msg.payload;\nif(t!==\"\")\n{\nk=t.split(':');\nfor (i = 0; i < k.length; i++)\n{\n k[i]=parseFloat(k[i]);\n}\nmsg.topic=\"Temperature\";\n\tif(k[0]&&k[1])\n\t\t{\n\t\tmsg.payload={\"DegC\":k[0],\"DegF\":k[1]};\n\t\treturn msg;\n\n }\n}\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":540,"wires":[["563647d0.68ebd8","1eeb94bf.26d04b"]]},{"id":"b87cafc6.11924","type":"influxdb","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"datastorage","name":"","usetls":false,"tls":"","influxdbVersion":"1.x","url":"http://localhost:8086","rejectUnauthorized":true}]

```

 ![Schermata 2021-08-12 alle 10.16.39](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/2/d26680444924068adcea68a9f4183f2b3a4a97b5.jpeg)

 ![Schermata 2021-08-12 alle 10.17.12](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/8/d88b7d37e9bb1152cc2103807ac5575b6e79a853.png)

The exec node has a PID. The script is working. I don't know why there is no output? Any hint?

Update  
could this be the problem?

```auto
pi@raspberrypi:~ $ sudo apt-get upgrade nodered
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libnode64 : Conflicts: nodejs-legacy
 nodered : Depends: npm (>= 5.8)
E: Broken packages

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [12 August 2021 08:29 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/2 "2021-08-12T08:29:54Z")

</div>

What version of Node-RED are you using?

How did you install Node-RED originally? Did you use our install script? If so, then you _do not_ use `apt-get` to update anything to do with Node-RED.

---

<div class="post-metadata">

**Author:** ![FeliceM](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@FeliceM](https://discourse.nodered.org/u/FeliceM)\
**Post date:** [12 August 2021 08:31 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/3 "2021-08-12T08:31:24Z")

</div>

It was installed by default with the Raspberry os.  
apt-get...... noted, thanks. I don't know why I used the apt-get!  
I update it with:

```auto
sudo npm install -g --unsafe-perm node-red

```

The version installed is V 1.3.5, but the problem is not solved. Still no output. Help!

---

<div class="post-metadata">

**Author:** ![leftymuller](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/leftymuller/32/102326_2.png) [@leftymuller](https://discourse.nodered.org/u/leftymuller)\
**Post date:** [12 August 2021 12:18 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/4 "2021-08-12T12:18:03Z")

</div>

Dont call the command in a shell script... thats what the problem is.

execute the command in the exec node

---

<div class="post-metadata">

**Author:** ![FeliceM](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@FeliceM](https://discourse.nodered.org/u/FeliceM)\
**Post date:** [13 August 2021 04:51 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/5 "2021-08-13T04:51:37Z")

</div>

Thanks but I don't think that's the problem. Has been working for months with the shell scripts.However I tried, same issue.  
I have left it running overnight and I noted something quite strange.  
The Python script output is timed every 30 seconds.

```auto
while True:
    try:
                 
          c,f=read_temp()
          a="{:.3f}:{:.3f}".format(c,f)
          print(a)
          
          time.sleep(30)

```

Looks like the stream of the script is stuck somewhere and it comes all together in one big batch. Look at the picture. The first output is correct (object with Deg C and Deg F), the second one is an error (string) which it gets filtered out by the function. Then it stop for hours until it happens again. I suspect my Nodered is broken.

```auto
[{"id":"f20693fd.b834c","type":"inject","z":"4e4990f3.d4ada","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":480,"wires":[["af021ac0.286e18"]]},{"id":"1eeb94bf.26d04b","type":"debug","z":"4e4990f3.d4ada","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":480,"wires":[]},{"id":"af021ac0.286e18","type":"exec","z":"4e4990f3.d4ada","command":" bash /home/pi/Develop/Temp/Temperature.sh","addpay":"","append":"","useSpawn":"true","timer":"","oldrc":false,"name":"Command Temperature","x":370,"y":540,"wires":[["2473ff7.e3f4d","1eeb94bf.26d04b"],[],[]]},{"id":"563647d0.68ebd8","type":"influxdb out","z":"4e4990f3.d4ada","influxdb":"b87cafc6.11924","name":"Temp-Influx","measurement":"temperature","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"organisation","bucket":"bucket","x":750,"y":580,"wires":[]},{"id":"2473ff7.e3f4d","type":"function","z":"4e4990f3.d4ada","name":"","func":"var t=msg.payload;\nif(t!==\"\")\n{\nk=t.split(':');\nfor (i = 0; i < k.length; i++)\n{\n k[i]=parseFloat(k[i]);\n}\nmsg.topic=\"Temperature\";\n\tif(k[0]&&k[1])\n\t\t{\n\t\tmsg.payload={\"DegC\":k[0],\"DegF\":k[1]};\n\t\treturn msg;\n\n }\n}\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":560,"wires":[["563647d0.68ebd8","1eeb94bf.26d04b"]]},{"id":"b87cafc6.11924","type":"influxdb","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"datastorage","name":"","usetls":false,"tls":"","influxdbVersion":"1.x","url":"http://localhost:8086","rejectUnauthorized":true}]

```

 ![Schermata 2021-08-13 alle 06.46.30](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/8/58525378c60ea2ef628d8d0b33cbd20b1c7a08ab.jpeg)

I may have to uninstall red node completely and reinstall it. Before I do that, any other hint? Thanks

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [13 August 2021 06:48 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/6 "2021-08-13T06:48:27Z")

</div>

How exactly are you calling the python from exec ? Are you using the -u parameter on python to ensure it is unbuffered ?

---

<div class="post-metadata">

**Author:** ![FeliceM](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@FeliceM](https://discourse.nodered.org/u/FeliceM)\
**Post date:** [13 August 2021 06:55 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/7 "2021-08-13T06:55:35Z")

</div>

Until now I use to call a bash and has been working for the last six months:

```auto
bash /home/pi/Develop/Temp/Temperature.sh

```

After the advice from Leftymuler above, I have tried to call directly the python script:

```auto
python /home/pi/Develop/Temp/Temperature.py

```

however I do not see any change. It is still not working. As I said it worked for months without issues. I tend to think that something is broken somewhere because there were no changes in the code neither in the flow when things started going wrong.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [13 August 2021 06:59 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/8 "2021-08-13T06:59:04Z")

</div>

Try adding -u to the python call

---

<div class="post-metadata">

**Author:** ![FeliceM](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@FeliceM](https://discourse.nodered.org/u/FeliceM)\
**Post date:** [13 August 2021 07:15 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/9 "2021-08-13T07:15:45Z")

</div>

Bingo!  
Looks like it is working.  
I do not understand why. Thanks a million for this.  
Could you please elaborate on this? I am eager to understand what could have happened.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [13 August 2021 07:25 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/10 "2021-08-13T07:25:58Z")

</div>

As I hinted, by default python will buffer its output (and release it now and again when the buffer is full or flushed) . the -u stops it buffering.

---

<div class="post-metadata">

**Author:** ![FeliceM](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@FeliceM](https://discourse.nodered.org/u/FeliceM)\
**Post date:** [14 August 2021 06:02 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/11 "2021-08-14T06:02:38Z")

</div>

Sorry to bother you again on this question. Can you point me to some reference for the -u. I am battling find it in the documentation.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [14 August 2021 06:31 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/12 "2021-08-14T06:31:19Z")

</div>

From man python:

```auto
$ man python
PYTHON(1) General Commands Manual PYTHON(1)

NAME
       python - an interpreted, interactive, object-oriented programming language
[snip]
SYNOPSIS
       python [-B] [-d] [-E] [-h] [-i] [-m module-name]
              [-O] [-OO] [-R] [-Q argument] [-s] [-S] [-t] [-u]
              [-v] [-V] [-W argument] [-x] [-3] [-?]
              [-c command | script | -] [arguments]
[snip]
COMMAND LINE OPTIONS

       -u Force stdin, stdout and stderr to be totally unbuffered. On systems where it matters, also put stdin, stdout and stderr in binary mode. Note that
              there is internal buffering in xreadlines(), readlines() and file-object iterators ("for line in sys.stdin") which is not influenced by this op‐
              tion. To work around this, you will want to use "sys.stdin.readline()" inside a "while 1:" loop.

```

---

<div class="post-metadata">

**Author:** ![FeliceM](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@FeliceM](https://discourse.nodered.org/u/FeliceM)\
**Post date:** [14 August 2021 06:33 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/13 "2021-08-14T06:33:33Z")

</div>

Thank you!  
Obviously I am not a coder. Just hobby but very curious.  
Thanks

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [14 August 2021 06:55 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/14 "2021-08-14T06:55:01Z")

</div>

Most commands and some system files have man pages.  
eg **man wpa\_supplicant** , **man wpa\_supplicant.conf**  
The contents tend to be terse and cryptic but they always list command line options and sometimes include examples of usage.  
**man** output is piped through **less** (I think) so you have to type q or CTRL C to get back to the dollar prompt.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 August 2021 06:55 UTC](https://discourse.nodered.org/t/no-output-from-node-why/49642/15 "2021-08-28T06:55:08Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
