Python Forum
Python 3.5.2 & json on win 10
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python 3.5.2 & json on win 10
#1
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
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]}
Reply


Messages In This Thread
Python 3.5.2 & json on win 10 - by PickyBiker - Nov-28-2016, 12:00 AM
RE: Python 3.5.2 & json on win 10 - by micseydel - Nov-28-2016, 12:04 AM
RE: Python 3.5.2 & json on win 10 - by PickyBiker - Nov-28-2016, 12:32 AM
RE: Python 3.5.2 & json on win 10 - by micseydel - Nov-28-2016, 12:36 AM
RE: Python 3.5.2 & json on win 10 - by PickyBiker - Nov-28-2016, 12:43 AM
RE: Python 3.5.2 & json on win 10 - by micseydel - Nov-28-2016, 12:48 AM
RE: Python 3.5.2 & json on win 10 - by PickyBiker - Nov-28-2016, 04:16 AM
RE: Python 3.5.2 & json on win 10 - by micseydel - Nov-28-2016, 04:21 AM
RE: Python 3.5.2 & json on win 10 - by snippsat - Nov-28-2016, 06:32 AM
RE: Python 3.5.2 & json on win 10 - by PickyBiker - Nov-28-2016, 04:24 PM
RE: Python 3.5.2 & json on win 10 - by micseydel - Nov-28-2016, 04:30 PM
RE: Python 3.5.2 & json on win 10 - by PickyBiker - Nov-28-2016, 04:32 PM
RE: Python 3.5.2 & json on win 10 - by micseydel - Nov-28-2016, 04:58 PM
RE: Python 3.5.2 & json on win 10 - by Ofnuts - Nov-28-2016, 06:00 PM
RE: Python 3.5.2 & json on win 10 - by PickyBiker - Nov-28-2016, 06:01 PM
RE: Python 3.5.2 & json on win 10 - by micseydel - Nov-28-2016, 07:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Split json into separate json based on node value CzarR 1 5,637 Jul-08-2022, 07:55 PM
Last Post: Larz60+
  difficulties to chage json data structure using json module in python Sibdar 1 2,095 Apr-03-2020, 06:47 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020