The reason for the error is that the JSON file is too large. Read it in a single line instead
with open("COCO_train.json", "r+") as f:
data = json.load(f)
to:
with open("COCO_train.json", "r+") as f:
data = f.readline()
Similar Posts:
- Python TypeError: file must have ‘read’ and ‘readline’ attributes
- Python: How to Solve raise JSONDecodeError(“Expecting value”, s, err.value) from None json.decoder…
- [Solved] TypeError: string indices must be integers, not str
- Python: json:json.decoder.JSONDecodeError: Invalid control character at: line 2 column 18 (char 19)
- [Solved] PostgreSQL configure: error: readline library not found
- Python JSON error json.decoder.jsondecodeerror Chinese
- [Solved] UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xa5 in position 1508: illegal multibyte sequence
- Tensorflow error due to uninitialized variable [How to Fix]
- [Solved] An error occurred when paddlepaddle iterated data: typeerror: ‘function’ object is not iterative
- [Solved] json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)