# Python Script no longer echos output?

**URL:** <https://forum.core-electronics.com.au/t/python-script-no-longer-echos-output/15611>\
**Category:** Uncategorized\
**Created:** [8 November 2022 22:50 UTC](https://forum.core-electronics.com.au/t/python-script-no-longer-echos-output/15611 "2022-11-08T22:50:53Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phil204480](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/phil204480/32/10317_2.png) [@Phil204480](https://forum.core-electronics.com.au/u/Phil204480)\
**Post date:** [8 November 2022 22:50 UTC](https://forum.core-electronics.com.au/t/python-script-no-longer-echos-output/15611/1 "2022-11-08T22:50:53Z")

</div>

Hi all,  
was running a Python Script successfully up till yesterday. Echoing output to cli.  
stopped the script and restarted and now script is no longer echoing output and is no longer working or displaying any errors?

Have tried Thony to debug says everything is correct?

Has anyone come across this?

I am running Raspberry Pi Zero and PiicDev\_BME280

---

<div class="post-metadata">

**Author:** ![Gramo](https://avatars.discourse-cdn.com/v4/letter/g/8491ac/32.png) [@Gramo](https://forum.core-electronics.com.au/u/Gramo)\
**Post date:** [9 November 2022 00:47 UTC](https://forum.core-electronics.com.au/t/python-script-no-longer-echos-output/15611/2 "2022-11-09T00:47:52Z")

</div>

Might be worth trying a basic script, without any other code

`print("Hello World")`

---

<div class="post-metadata">

**Author:** ![Trent5487676](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/trent5487676/32/4583_2.png) [@Trent5487676](https://forum.core-electronics.com.au/u/Trent5487676)\
**Post date:** [9 November 2022 03:39 UTC](https://forum.core-electronics.com.au/t/python-script-no-longer-echos-output/15611/3 "2022-11-09T03:39:37Z")

</div>

Hi Phil,

Were you able to get the script to do a basic print() command as Gramo has suggested? This would isolate the PiicoDev sensor setup and hardware from the equation and might help pinpoint what’s changed.

---

<div class="post-metadata">

**Author:** ![Phil204480](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/phil204480/32/10317_2.png) [@Phil204480](https://forum.core-electronics.com.au/u/Phil204480)\
**Post date:** [9 November 2022 03:55 UTC](https://forum.core-electronics.com.au/t/python-script-no-longer-echos-output/15611/4 "2022-11-09T03:55:44Z")

</div>

Hi Trent and @Gramo. the Piico Sensor is working fine. This script is working correctly.  
However, the other script that I wrote was echoing correctly and this has just stopped working.  
You can run the script, i.e. python3 script.py and this gives no echo and or errors?  
strange.

---

<div class="post-metadata">

**Author:** ![Trent5487676](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/trent5487676/32/4583_2.png) [@Trent5487676](https://forum.core-electronics.com.au/u/Trent5487676)\
**Post date:** [9 November 2022 04:07 UTC](https://forum.core-electronics.com.au/t/python-script-no-longer-echos-output/15611/5 "2022-11-09T04:07:19Z")

</div>

Hi Phil,

Does a totally new script with just hello world echo? Or does only your custom script not return the echo?

If an otherwise blank script returns the echo then we’ll know that it’s something in your script.py which is causing the strange behaviour, even if other functions of the script are still performing their jobs normally.

---

<div class="post-metadata">

**Author:** ![Phil204480](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/phil204480/32/10317_2.png) [@Phil204480](https://forum.core-electronics.com.au/u/Phil204480)\
**Post date:** [9 November 2022 04:28 UTC](https://forum.core-electronics.com.au/t/python-script-no-longer-echos-output/15611/6 "2022-11-09T04:28:54Z")

</div>

> [@Gramo](#):
>
> print(“Hello World”)

Hi Trent,

the affected script is pi@pi0w-weather-stn-herm:~/Weather $ python3 vk5rkw\_weather\_station4.py  
testhello.py echos out Hello World as per @Gramo

pi@pi0w-weather-stn-herm:~/Weather python3 vk5rkw\_weather\_station4.py pi@pi0w-weather-stn-herm:~/Weather python3 testhello.py  
Hello World

PiicoDev\_BME280 script works fine

pi@pi0w-weather-stn-herm:~/PiicoDev $ python3 piicodev\_to\_mqtt5.py  
30.17 °C 957.8265234375 hPa 26.607421875 % RH  
sending {sensor data} to server  
30.16 °C 957.7457421875 hPa 26.4169921875 % RH

vk5rkw\_weather\_station4.py can be found here:  
[PhilKern65/aprs-weather: Weather data using a PiicoDev\_BME280 sensor and Raspberry Pi Zero and transmit weather data via APRS (github.com)](https://github.com/PhilKern65/aprs-weather)

Cheers in advance

---

<div class="post-metadata">

**Author:** ![Gramo](https://avatars.discourse-cdn.com/v4/letter/g/8491ac/32.png) [@Gramo](https://forum.core-electronics.com.au/u/Gramo)\
**Post date:** [9 November 2022 07:33 UTC](https://forum.core-electronics.com.au/t/python-script-no-longer-echos-output/15611/7 "2022-11-09T07:33:24Z")

</div>

Python is an interpreted language; each line of code is interpreted and then run. Perhaps add print statements with basic debug text, starting at line 1 and every so often as you feel appropriate.

Don’t go overboard first time around, you’ll soon iterate toward the issue and find out which line of code is the problem.

When a line of code fails you get an error on the terminal. Interesting that you don’t, so it’s more likely an infinite loop or blocking call never completes.

Good luck and let me know how you go!

---

<div class="post-metadata">

**Author:** ![Phil204480](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/phil204480/32/10317_2.png) [@Phil204480](https://forum.core-electronics.com.au/u/Phil204480)\
**Post date:** [10 November 2022 04:10 UTC](https://forum.core-electronics.com.au/t/python-script-no-longer-echos-output/15611/8 "2022-11-10T04:10:57Z")

</div>

Thanks, will check and advise.

Phil

---

<div class="post-metadata">

**Author:** ![Phil204480](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/phil204480/32/10317_2.png) [@Phil204480](https://forum.core-electronics.com.au/u/Phil204480)\
**Post date:** [14 November 2022 12:18 UTC](https://forum.core-electronics.com.au/t/python-script-no-longer-echos-output/15611/9 "2022-11-14T12:18:17Z")

</div>

Hi @Gramo…After many hours of trial and error, I simply just started again.  
Its working, but needs some legacy code removed.

> **[APRS/CWOP weather report from VK5RKW – Google Maps APRS](https://aprs.fi/weather/a/VK5RKW)**
>
> APRS/CWOP weather report from VK5RKW (X)

Thanks again.

Phil

---

<div class="post-metadata">

**Author:** ![James46717](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@James46717](https://forum.core-electronics.com.au/u/James46717)\
**Post date:** [15 November 2022 01:16 UTC](https://forum.core-electronics.com.au/t/python-script-no-longer-echos-output/15611/10 "2022-11-15T01:16:18Z")

</div>

Recently I experienced something similar.  
I cut and pasted some code from a web page and it did not work as it should.

When I typed in the code it worked ok.

I put it down to some characters in the cut and paste which were hidden in the text display but affected the running of the code. Thonny

When I cut and paste now; I will put it into a simple text editor like the one that comes with Windows 10. Then cut and paste the text from the text editor.

Unsure if this is your problem, but it was confusing at the time.

cheers  
Jim

---

<div class="post-metadata">

**Author:** ![MengLinMaker](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/menglinmaker/32/7497_2.png) [@MengLinMaker](https://forum.core-electronics.com.au/u/MengLinMaker)\
**Post date:** [16 November 2022 10:44 UTC](https://forum.core-electronics.com.au/t/python-script-no-longer-echos-output/15611/11 "2022-11-16T10:44:00Z")

</div>

Hi James, from your description it sounds like maybe it’s a space/tab issue.  
Some people like to use tabs instead of spaces, visa-versa.

**For Python, which is indent sensitive, mixing spaces and tabs should be avoided.**  
**So even if the spacing/tab looks the same, the interpreter does not think so.**

Sorry, this probably doesn’t answer the main topic.
