Close#
Explicitly closing resource file handlers and open stream handles.
The function molsysmt.form.close() safely closes open disk streams and underlying file handles for forms registered under RESOURCE_FORMS.
Added in version 1.0.0.
API documentation
Follow this link for a detailed description of the input arguments, raised errors, and returned objects of this function: molsysmt.form.close().
Basic usage#
Let’s open and close a file handler stream:
import molsysmt as msm
h5_handler = msm.convert(msm.systems['Barnase-Barstar']['barnase_barstar.h5msm'], to_form='molsysmt.H5MSMFileHandler')
Note
Demo Systems Catalog
This tutorial uses demonstration datasets provided by MolSysMT. To explore the full catalog of bundled systems, forms, and file paths, visit the Demo Systems guide.
print('Handler open:', h5_handler)
msm.form.close(h5_handler)
print('Closed successfully.')
Handler open: <molsysmt.native.h5msm_file_handler.H5MSMFileHandler object at 0x7ff0075ff230>
Closed successfully.
See also
Related Tools & References
Is file: Check file form status with
molsysmt.form.is_file().Get attributes: Query full attribute dictionary with
molsysmt.form.get_attributes().