# No data going to Luftdaten when started from cron - ok for manual start from terminal

**URL:** <https://forums.pimoroni.com/t/no-data-going-to-luftdaten-when-started-from-cron-ok-for-manual-start-from-terminal/11419>\
**Category:** Support\
**Created:** [August 25, 2019, 3:16pm UTC](https://forums.pimoroni.com/t/no-data-going-to-luftdaten-when-started-from-cron-ok-for-manual-start-from-terminal/11419 "2019-08-25T15:16:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattybaus60](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@mattybaus60](https://forums.pimoroni.com/u/mattybaus60)\
**Post date:** [August 25, 2019, 3:16pm UTC](https://forums.pimoroni.com/t/no-data-going-to-luftdaten-when-started-from-cron-ok-for-manual-start-from-terminal/11419/1 "2019-08-25T15:16:00Z")

</div>

running the suggested script from the tutorial for adding a cron start works OK  
The system starts and the display shows the ID and wifi connected  
but no data is being seen at luftdaten

i added a sleep step to cron to ensure that the network was stable and again the envrio starts but nothing seems to be getting to luftdaten

when I run the command from terminal I get this error

_ **pi@raspberrypi:~ $ sudo python /home/pi/enviroplus-python/examples/luftdaten.py** _  
_ **luftdaten.py - Reads temperature, pressure, humidity,** _  
_ **PM2.5, and PM10 from Enviro plus and sends data to Luftdaten,** _  
_ **the citizen science air quality project.** _

_ **Note: you’ll need to register with Luftdaten at:** _  
_**[https://meine.luftdaten.info/](https://meine.luftdaten.info/) and enter your Raspberry Pi**_  
_ **serial number that’s displayed on the Enviro plus LCD along** _  
_ **with the other details before the data appears on the** _  
_ **Luftdaten map.** _

_ **Press Ctrl+C to exit!** _

_**Traceback (most recent call last):**_  
\*\*\* File “/home/pi/enviroplus-python/examples/luftdaten.py”, line 164, in \*\*\*  
\*\*\* font = ImageFont.truetype(“fonts/Asap/Asap-Bold.ttf”, font\_size)\*\*\*  
\*\*\* File “/usr/lib/python2.7/dist-packages/PIL/ImageFont.py”, line 280, in truetype\*\*\*  
\*\*\* return FreeTypeFont(font, size, index, encoding, layout\_engine)\*\*\*  
\*\*\* File “/usr/lib/python2.7/dist-packages/PIL/ImageFont.py”, line 145, in **init** \*\*\*  
\*\*\* layout\_engine=layout\_engine)\*\*\*  
_ **IOError: cannot open resource** _

The Asap-Bold.ttf font exists in the examples/fonts directory - i looked for it.

rasberry Pi Zero  
raspbian buster full  
enviroplus with particle sensor

any thoughts or diagnostic tips would be most appreciated

Matt

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [August 25, 2019, 4:45pm UTC](https://forums.pimoroni.com/t/no-data-going-to-luftdaten-when-started-from-cron-ok-for-manual-start-from-terminal/11419/2 "2019-08-25T16:45:06Z")

</div>

I had a kind of semi related issue with my pirate radio. Sometimes it wouldn’t stream on boot up. Or switch channels on me. My best guess was my WIFI was slow to connect so it automatically cycled through my playlist looking for a working stream. I went into raspi-config and ticked the box for “wait for network” and problem solved. It takes a bit longer to boot up but it now reliably streams the channel “I had left it on” when I shut it down.

---

<div class="post-metadata">

**Author:** ![mattybaus60](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@mattybaus60](https://forums.pimoroni.com/u/mattybaus60)\
**Post date:** [August 26, 2019, 12:39am UTC](https://forums.pimoroni.com/t/no-data-going-to-luftdaten-when-started-from-cron-ok-for-manual-start-from-terminal/11419/3 "2019-08-26T00:39:31Z")

</div>

Thanks - good suggestion.

I tried that but it did’t work.

I have a 5 minute @reboot pause in cron which should allow things to settle and I can confirm the network is connected because I can VNC into the unit after boot but before the cron pause lights up the luftdaten script ( shown when the oled booms to life and has the serial number and wifi connected messages)

i am at a loss to diagnose this as I am a newbie with rasbian/linux etc

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [August 26, 2019, 8:16am UTC](https://forums.pimoroni.com/t/no-data-going-to-luftdaten-when-started-from-cron-ok-for-manual-start-from-terminal/11419/4 "2019-08-26T08:16:06Z")

</div>

I’m not any smarter Linux wise. There are some smart people that hang out here, Linux etc smarts anyway, lol. Hopefully one of those see’s your thread.

---

<div class="post-metadata">

**Author:** ![cytos](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/cytos/32/5967_2.png) [@cytos](https://forums.pimoroni.com/u/cytos)\
**Post date:** [October 5, 2019, 9:24pm UTC](https://forums.pimoroni.com/t/no-data-going-to-luftdaten-when-started-from-cron-ok-for-manual-start-from-terminal/11419/5 "2019-10-05T21:24:48Z")

</div>

Hi, I came across this same problem today. I think the suggestion in the tutorial to run the luftdaten.py script at startup using @reboot runs the script as root, and the script therefore can’t find the font file. If you change the path on line 164 from:

`font = ImageFont.truetype("fonts/Asap/Asap-Bold.ttf", font_size)`

to, e.g. (or whatever your full path is)

`font = ImageFont.truetype("/home/pi/Pimoroni/enviroplus/examples/fonts/Asap/Asap-Bold.ttf", font_size)`

then it should work

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [October 6, 2019, 8:50am UTC](https://forums.pimoroni.com/t/no-data-going-to-luftdaten-when-started-from-cron-ok-for-manual-start-from-terminal/11419/6 "2019-10-06T08:50:04Z")

</div>

My crontab entries go something like this, I forget what the & does?  
`@reboot python3 /home/pi/myfile.py &`

EDIT: The “&” at the end of the line means the command is run in the background and it won’t stop the system booting up. Something like that anyway.

---

<div class="post-metadata">

**Author:** ![mattybaus60](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@mattybaus60](https://forums.pimoroni.com/u/mattybaus60)\
**Post date:** [October 7, 2019, 3:39am UTC](https://forums.pimoroni.com/t/no-data-going-to-luftdaten-when-started-from-cron-ok-for-manual-start-from-terminal/11419/7 "2019-10-07T03:39:36Z")

</div>

Yes got that after doing more learning

All working fine now

Should have piked up the path issue earlier… just didn’t register in my head

Cheers

Matt
