NVIDIA/DALI

Can't suppress warnings

Open

#4396 aperta il 27 ott 2022

Vedi su GitHub
 (1 commento) (0 reazioni) (1 assegnatario)C++ (670 fork)auto 404
help wanted

Metriche repository

Star
 (5722 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

I would like to suppress some warnings. Normally I could use the following code to do suppress all warnings.

import warnings
warnings.filterwarnings('ignore')

But when I import nvidia.dali there is still a warning shown. It looks like this comes from backend.py:

def deprecation_warning(what):
    # show only this warning
    with warnings.catch_warnings():
        warnings.simplefilter("default")
        warnings.warn(what, Warning, stacklevel=2)

The simplefilter just overwrites all previously changed warning setting. You could set the filter to lowest priority to not override everything already set with: warnings.simplefilter("default", append=True)

Or is there something I am missing? Thanks already.

Guida contributor