The error "expecting value" is occurring when I'm trying to read a json file which I have created myself. The weird thing is that this used to work. I was working on another project in between and did some updates to conda and now I'm getting the error. I've searched and found similar questions but none that have been applicable in my case.
This is what I'm doing right now:
def show_json(filepath):
with open("/Users/human/Doc/PYTHON/bn/bread/"+filepath) as f:
k = json.load(f)
return k
state_d = show_json("states_json.json")
Here is the error traceback:
File "/Users/human/PYTHON/SPYDER/bn/bread/main_.py", line 55, in <module>
state_d=show_json("states_json.json")
File "/Users/human/PYTHON/SPYDER/bn/bread/main_.py", line 48, in show_json
k = json.load(f)
File "/Users/human/opt/anaconda3/envs/futures/lib/python3.8/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/Users/human/opt/anaconda3/envs/futures/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/Users/human/opt/anaconda3/envs/futures/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Users/human/opt/anaconda3/envs/futures/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
JSONDecodeError: Expecting value
And this is what the json file looks like:
{"_state_one_":None,"_state_two_":None,"_state_three_":None,"_state_four_":None}
Could something have happened while updating some libraries and packages or am I just doing something wrong code-wise?