如何处理这个错误?json.decoder.JSONDecodeError:期望值:第1行第1列(char 0)

时间:2018-05-24 02:36:38

标签: json python-3.x

我已经查看了同样多的类似问题但是似乎无法找到解决方案。有人能引导我找到解决方案吗? 我在执行代码时遇到此错误...错误如下:

raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

这是我的代码:

IMAGEDATA = json.loads(open("imagedata.json",'r').read())

JSON文件如下:

["-533479225","1190868050","-858804567","-478770949","34712964","-880781543","867322169","991305586","-316899420"]

整个堆栈跟踪是:

File "C:\Users\britl\source\repos\FLASHBOT\FLASHBOT\Nike\nikesensor.py", line 9, in <module>
    IMAGEDATA = json.load(open("imagedata.json",'r')).read()
  File "C:\Users\britl\AppData\Local\Programs\Python\Python36\lib\json\__init__.py", line 299, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "C:\Users\britl\AppData\Local\Programs\Python\Python36\lib\json\__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "C:\Users\britl\AppData\Local\Programs\Python\Python36\lib\json\decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\britl\AppData\Local\Programs\Python\Python36\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)

0 个答案:

没有答案