json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Whenever I try to run py homeScript.py -l or any other command, I get the error json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0). More specifically, the error is:
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.2.42:8581
DEBUG:urllib3.connectionpool:http://192.168.2.42:8581 "GET /accessories HTTP/1.1" 200 1608
ERROR:root:<class 'Exception'>
Traceback (most recent call last):
File "homeScript.py", line 40, in getAccessories
getAcc = getAcc.json()
File "C:\Users\USER\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\models.py", line 900, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\USER\AppData\Local\Programs\Python\Python38\lib\json\__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "C:\Users\USER\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\USER\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Seems to be working fine on version 4.0 but not version 5.
Please attach debug files.
See Note in the readme
Note: as of HomeScript 4.1 the minimum requirement is Python3+ and HomeBridge 1.x.x+
Please check your HomeBridge and Python versions
Both my HomeBridge and Python versions are sufficient.
Debug files: homescript_exception_2021.01.03.log homescript_debug_2021.01.03.log
Try on v5.1.1.
Note that hs.py -l is currently buggy. Append a listing type with it such as: hs.py -l type or hs.py -l json
also getting this error with python3 and latest homekit:
$~/homebridge-automation $ python3 hs.py -l json
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/homescript/__init__.py", line 36, in getAccessories
getAcc = getAcc.json()
File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.7/json/decoder.py", line 355, 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 "hs.py", line 57, in <module>
hs = homescript.HomeScript(__HOSTNAME__,__PORT__,__AUTH__, args.debug, sys.argv)
File "/home/pi/.local/lib/python3.7/site-packages/homescript/__init__.py", line 24, in __init__
self.getAccessories()
File "/home/pi/.local/lib/python3.7/site-packages/homescript/__init__.py", line 51, in getAccessories
if self.debug:
AttributeError: 'HomeScript' object has no attribute 'debug'