Skip to content

Conversation

@grahamfindlay
Copy link
Contributor

The json.load(open(...)) pattern leaves file handles open, causing ResourceWarning when Python is run with warnings enabled. This is particularly noisy when using multiprocessing, as each worker triggers the warning when importing the module.

Changes:

  • neuropixels_tools.py: Use context manager in _load_np_probe_features()
  • testing.py: Use context manager when loading JSON schema

Both files now properly close file handles using 'with' statements.

The json.load(open(...)) pattern leaves file handles open, causing
ResourceWarning when Python is run with warnings enabled. This is
particularly noisy when using multiprocessing, as each worker triggers
the warning when importing the module.

Changes:
- neuropixels_tools.py: Use context manager in _load_np_probe_features()
- testing.py: Use context manager when loading JSON schema

Both files now properly close file handles using 'with' statements.

Fixes issue reported for Python 3.14 on Linux with forkserver multiprocessing.
@alejoe91
Copy link
Member

Thanks @grahamfindlay ! :)

@alejoe91 alejoe91 merged commit 4cb28b6 into SpikeInterface:main Jan 14, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants