Python errors importing logs

root@mustang:~# python3 /var/www/htdocs/matomo/misc/log-analytics/import_logs.py --url=www.sdc.com.au/matomo --idsite=SDC /var/log/httpd/access_log
Traceback (most recent call last):
File “/var/www/htdocs/matomo/misc/log-analytics/import_logs.py”, line 1884, in _call_api
return json.loads(res)
^^^^^^^^^^^^^^^
File “/usr/lib64/python3.12/json/init.py”, line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib64/python3.12/json/decoder.py”, line 338, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib64/python3.12/json/decoder.py”, line 356, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/var/www/htdocs/matomo/misc/log-analytics/import_logs.py”, line 2986, in
resolver = config.get_resolver()
^^^^^^^^^^^^^^^^^^^^^
File “/var/www/htdocs/matomo/misc/log-analytics/import_logs.py”, line 1427, in get_resolver
return StaticResolver(self.options.site_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/var/www/htdocs/matomo/misc/log-analytics/import_logs.py”, line 1959, in init
site = matomo.call_api(
^^^^^^^^^^^^^^^^
File “/var/www/htdocs/matomo/misc/log-analytics/import_logs.py”, line 1943, in call_api
return self._call_wrapper(self._call_api, None, None, method, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/var/www/htdocs/matomo/misc/log-analytics/import_logs.py”, line 1895, in _call_wrapper
response = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/var/www/htdocs/matomo/misc/log-analytics/import_logs.py”, line 1886, in _call_api
raise urllib.error.URLError('Matomo returned an invalid response: ’ + res.decode(“utf-8”) )
^^^^^^^^^^
AttributeError: ‘str’ object has no attribute ‘decode’. Did you mean: ‘encode’?
root@mustang:~# python --version
Python 3.12.12

Click to view System Check

Mandatory checks

PHP version >= 7.2.5:

:check_mark: 8.3.29

PDO extension:

:check_mark:

PDO\MYSQL extension:

:check_mark:

MYSQLI extension:

:check_mark:

Other required extensions:

:check_mark: zlib :check_mark: json :check_mark: filter :check_mark: hash :check_mark: session

Required functions:

:check_mark: debug_backtrace :check_mark: escapeshellarg :check_mark: eval :check_mark: hash :check_mark: gzcompress :check_mark: gzuncompress :check_mark: pack

Required PHP configuration (php.ini):

:check_mark: session.auto_start = 0 :check_mark: max_execution_time = 0 OR = -1 OR >= 30

Directories with write access:

:check_mark: $DOC_ROOT/tmp :check_mark: $DOC_ROOT/tmp/assets :check_mark: $DOC_ROOT/tmp/cache :check_mark: $DOC_ROOT/tmp/climulti :check_mark: $DOC_ROOT/tmp/latest :check_mark: $DOC_ROOT/tmp/logs :check_mark: $DOC_ROOT/tmp/logos :check_mark: $DOC_ROOT/tmp/sessions :check_mark: $DOC_ROOT/tmp/tcpdf :check_mark: $DOC_ROOT/tmp/templates_c :check_mark: $DOC_ROOT/config

Optional checks

File integrity:

:check_mark:

64-bit PHP Binary:

:check_mark:

Tracker status:

:check_mark:

Memory limit:

:check_mark: 128M

Time zone:

:check_mark:

Open URL:

:check_mark: curl

PageSpeed is turned off:

:check_mark:

GD > 2.x + FreeType (graphics):

:check_mark:

Other extensions:

:check_mark: json :check_mark: libxml :check_mark: dom :check_mark: SimpleXML :check_mark: openssl

Other functions:

:check_mark: shell_exec :check_mark: set_time_limit :check_mark: mail :check_mark: parse_ini_file :check_mark: glob :check_mark: gzopen :check_mark: md5_file :check_mark: hash_file

Filesystem:

:check_mark:

Set up Cron - Managing processes via CLI:

:check_mark: Ok

Update over HTTPS:

:check_mark:

Writable JavaScript Tracker (“/matomo.js”):

:check_mark:

Informational results

Matomo Version:

5.8.0

PHP_OS:

Linux

PHP SAPI:

:warning: Warning: fpm-fcgiPHP FPM will ignore .htaccess rules for .php files. To ensure that sensitive files cannot be accessed directly it is recommended to exclude certain directories from being handled by PHP FPM by adding the line ProxyPass /config ! to the mod_proxy_fcgi.c section in your apache virtual host config just above the ProxyPassMatch line.

PHP Timezone:

UTC

PHP Time:

1773126322

PHP Datetime:

2026-03-10 07:05:22

PHP INI max_execution_time:

30

PHP INI post_max_size:

8M

PHP INI max_input_vars:

1000

PHP INI zlib.output_compression:

Curl Version:

8.12.1, OpenSSL/3.5.1

Suhosin Installed:

0

Server Info:

Apache/2.4.63 (Rocky Linux)

User Agent:

Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0

Browser Language:

en-us,en