​​The Cambridge Crystallographic Data Centre (CCDC).
The CCDC websites use cookies. By continuing to browse the site you are agreeing to our use of cookies. For more details about cookies and how to manage them, see our  cookie policy.

Managing warning messages from the CSD Python API


Warning messages from the CSD Python API can be suppressed or turned into errors using a native Python feature described at this link.

The function to use is warnings.filterwarnings.

To throw an exception whenever a deprecated function is called:

import warnings
warnings.filterwarnings('error', '.*deprecated.*', DeprecationWarning, '.*', 0)


To instead ignore all warnings about deprecated functions:

import warnings
warnings.filterwarnings('ignore', '.*deprecated.*', DeprecationWarning, '.*', 0)