Python errors using log file analytics method

I have Matomo installed, but having difficulties trying to get it to use the log file analytics method.

I have a log file, and I have a measurement setup in Matamo.

However, when I run the python script, I just get an error:

This is using Python version 3.8.10.

Any help you can provide would be appreciated. Many thanks.

Log file example: