Skip to content Skip to sidebar Skip to footer

Suppress Warnings On Import?

Assuming I write a python package that has to use the imp module, and my package is 'TestModule' which is the following: import imp import pip import sys def update_and_reload(mod

Solution 1:

Well you could use the warning module:

import warnings

with warnings.catch_warnings():
    warnings.filterwarnings("ignore", category=DeprecationWarning)
    import imp
import pip
...    

Post a Comment for "Suppress Warnings On Import?"