Здравствуйте, у меня при попытке чтения json файла происходит ошибка:
Traceback (most recent call last):
File "C:\Users\GroMan\PycharmProjects\PaperRockScissors\app.py", line 125, in
main()
File "C:\Users\GroMan\PycharmProjects\PaperRockScissors\app.py", line 64, in main
dire = json.load(jsonconfig)
File "C:\Users\GrroMan\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 293, in load
return loads(fp.read(),
File "C:\Users\Мария\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\GroMan\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Мария\AppData\Local\Programs\Python\Python39\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)
Process finished with exit code 1
Вот код чтения файла:
jsonconfig = open('media/config.json', 'r', encoding='utf-8')
if json.load(jsonconfig)['DEBUG']:
dire = json.load(jsonconfig)
dire = dire['directory']
Вот текст в json файле:
{"DEBUG": true, "directory": "C:/Games/MudRunner/Media"}
.