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

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/ - 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: 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/”, line 164, in ***
*** font = ImageFont.truetype(“fonts/Asap/Asap-Bold.ttf”, font_size)***
*** File “/usr/lib/python2.7/dist-packages/PIL/”, line 280, in truetype***
*** return FreeTypeFont(font, size, index, encoding, layout_engine)***
*** File “/usr/lib/python2.7/dist-packages/PIL/”, 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


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.

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

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.

Hi, I came across this same problem today. I think the suggestion in the tutorial to run the 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

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

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.

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