Managing warning messages from the CSD Python API

Modified on Mon, 20 Jan at 1:17 PM

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)

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article