Python interface reference

The Python interface is exposed in the chemfiles module, and this page list all the classes and methods in this module.

Error handling

Chemfiles uses exceptions for error handling, throwing ChemfilesError when an error occurs.

exception chemfiles.misc.ChemfilesError

Exception class for errors in chemfiles

exception chemfiles.misc.ChemfilesWarning

Warnings from the Chemfiles runtime.


Read configuration data from the file at path.

By default, chemfiles reads configuration from any file name .chemfilesrc in the current directory or any parent directory. This function can be used to add data from another configuration file.

This function will fail if there is no file at path, or if the file is incorectly formatted. Data from the new configuration file will overwrite any existing data.


Call function on every warning event. The callback should take a string message and return nothing.

By default, warnings are send to python warnings module.