Nov-28-2016, 12:00 AM
I have uninstalled python on my win 10 system and re-installed python 3.5.2. The following tiny bit of code causes a series of error messages
{"zones": [[1, 3], [3, 5], [5, 89]], "weekdays": [1, 2], "ontime": [5, 1]}
import json with open('schedule.json') as data_file: data = json.load(data_file) print(data) close("schedule.json")here is the error message:
Error:Traceback (most recent call last):
File "read_json.py", line 4, in <module>
data = json.load(data_file)
File "C:\Users\Michael\AppData\Local\Programs\Python\Python35\lib\json\__init__.py", line 268, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "C:\Users\Michael\AppData\Local\Programs\Python\Python35\lib\json\__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "C:\Users\Michael\AppData\Local\Programs\Python\Python35\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Michael\AppData\Local\Programs\Python\Python35\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
------------------
(program exited with code: 1)
Press any key to continue . . .
And finally, here is the schedule.json file:{"zones": [[1, 3], [3, 5], [5, 89]], "weekdays": [1, 2], "ontime": [5, 1]}