adorobis / speedtest-CLI2mqtt

Publishing Speedtest results to MQTT for Home Assistant integration using official speedtest CLI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

json.decoder.JSONDecodeError

mushuthecat opened this issue · comments

Hello,

im facing to a new issue since few days:

Traceback (most recent call last):
  File "/usr/src/app/./speedtest.py", line 312, in <module>
    run_speedtest()
  File "/usr/src/app/./speedtest.py", line 84, in run_speedtest
    st_results = json.loads(stderr)
                 ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
               ^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 6 (char 5)
Traceback (most recent call last):
  File "/usr/src/app/./speedtest.py", line 312, in <module>
    run_speedtest()
  File "/usr/src/app/./speedtest.py", line 84, in run_speedtest
    st_results = json.loads(stderr)
                 ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
               ^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 6 (char 5)
Traceback (most recent call last):
  File "/usr/src/app/./speedtest.py", line 312, in <module>
    run_speedtest()
  File "/usr/src/app/./speedtest.py", line 84, in run_speedtest
    st_results = json.loads(stderr)
                 ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)

Regards

commented

Do you still face it? I've just seen it in my logs as well logged yesterday but today it all works ok. I would assume the speedtest.net was not returning properly formatted data.

Hi,

i solved my issue right by having a look to the speedtest.log
it seems that the server that i had setup in my config.ini failed is no more available after changing the value it seems to work thanks :D

commented

OK, great! It is interesting that the container log is showing something different than the speedtest.log :) But indeed it is much more meaningful there.

commented

Btw, I could not reproduce the error. If I enter a non existent server it would nicely log it in the speedtest.log file and update the Speedtest.net Status sensor with the error message in its attributes like below:
image

Hi

I was using the serverd id: 24215 before solving my issue with a new one : 29544

this is the extract of my HA log files when the problem occured

image
image

Regards