pout icon indicating copy to clipboard operation
pout copied to clipboard

pout method to ignore deprecation errors?

Open Jaymon opened this issue 2 years ago • 0 comments

Since developing on python3 full time I've been super annoyed by how many deprectation warnings I get in libraries I have no control over, this works in sitecustomize.py to get rid of the errors:

import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)

But I would like to see deprecation warnings for my own code. I think a solution could be having a pout method I could call at the top of the script or in sitecustomize.py that would set up a filter and only suprress the warning in site-modules installed python modules and let everything else through.

Looking at the filterwarnings docs it doesn't appear to have just like a callback I can pass it or anything, it does have a module that is a regex to filter modulepaths I would guess, but I would need to run some tests.

I think I could track the code down and find out how it is doing it and maybe add a logging filter or something also.

I got the above code from here

Jaymon avatar Jan 25 '22 01:01 Jaymon