Skip to content

fix: hdf5_autocomplete_config raised AttributeError for path input - #423

Merged
paulmueller merged 1 commit into
DC-analysis:mainfrom
paulmueller-agent:fix/hdf5-autocomplete-config-path
Nov 19, 2026
Merged

paulmueller merged 1 commit into
DC-analysis:mainfrom
paulmueller-agent:fix/hdf5-autocomplete-config-path

Conversation

@paulmueller-agent

Copy link
Copy Markdown
Contributor

export.hdf5_autocomplete_config(path_or_h5obj) (deprecated) only had to close the file when it opened it itself, i.e. when a path was given. However, it called path_or_h5obj.close(), so for str/pathlib.Path input this was str.close()/PosixPath.close():

>>> export.hdf5_autocomplete_config("data.rtdc")
AttributeError: 'str' object has no attribute 'close'
>>> export.hdf5_autocomplete_config(pathlib.Path("data.rtdc"))
AttributeError: 'PosixPath' object has no attribute 'close'

The metadata were written, but the HDF5 file opened by the RTDCWriter was never closed. For an h5py.File input it worked (and the file stays open). Now RTDCWriter.close() is called, which only closes the file if the writer opened it (owns_path). The now unused h5py import is removed from export.py.

New parametrized test test_hdf5_autocomplete_config_deprecated (str, pathlib.Path, h5py.File; the path variants fail without the fix).

🤖 Generated with Claude Code

The function called `.close()` on the str/pathlib.Path object instead
of closing the RTDCWriter (and thus the file it opened).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paulmueller-agent
paulmueller-agent force-pushed the fix/hdf5-autocomplete-config-path branch from ef64352 to adacfb1 Compare November 19, 2026 09:29
@paulmueller
paulmueller merged commit 440bdc4 into DC-analysis:main Nov 19, 2026
3 of 4 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