Making the Automation HAT Mini output example portable

I’m working through the samples from the subject board. I moved the example into my project python folder and it failed with this error:

Traceback (most recent call last):
File “/usr/lib/cgi-bin/”, line 78, in
File “/usr/lib/cgi-bin/”, line 29, in draw_states
image =“images/outputs-blank.jpg”)
File “/usr/lib/python3/dist-packages/PIL/”, line 2904, in open
fp =, “rb”)

I found that the program had a relative link in line 31. I replaced this line


with this line


And it now works. Hope that helps someone… or perhaps me in the future!

The other way to do it is to copy the images folder to the same folder you put in.
It “should work”, I’ve hit similar snags with Enviro+ code that looks for icons. Moving the icons folder with the example file fixes it for me.

That’s true! Probably a good idea in the long term, but for those taking things step by step it might be helpful.

True enough, there’s usually more than one way to get things working the way you want.

For me, I run modified Enviro code on a couple of different builds. And don’t own or use an Enviro or Enviro+. They are equivalent setups with Breakout Garden stuff. I don’t ever run the Enviro Installer. I just copied the examples and what ever else I needed from the Enviro repository. And run the separate installers for the breakouts I’m using, SPI LCD, BME280, etc.