Which fix removes the bug?
import json data = json.load(open(path))
- Open inside a with block
- Use json.loads on text
- Pass encoding to open
- Catch a decode error
The file handle is never closed, so descriptors leak until the collector happens to run.
Play Problem Solving ▸