Automation Hat Mini from Apache2 web access

I’m running the Automation Hat Mini on a Pi 4. I’m writing to the on-board screen very nicely through Python from the command line.

However, when I execute the same script through the Apache2 web interface the code runs with no errors, but the on-board screen is not updating.

Perhaps this is a permission error, since the Apache code runs as a different user? If that’s it, what needs different permissions and set to what?

I thought the problem may be with access to the i2c bus, since access is allowed only to members of the i2c group. So I tried this sequence, which worked on another board:

sudo usermod -a -G i2c www-data
sudo systemctl restart apache2

However, this did not allow the Automation Hat to run from a web browser call.

It hangs up on this line:

disp = ST7735.ST7735(

What is the display call doing which requires permissions? Thanks for any suggestions.

By the way, this HAT is SO much easier to work with generally…