Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

suppress deprecation in python

so - I'm using a library pyminizip - which is the only way I've found to create a password protected zip file. When I use it I get a deprecationwarning: PY_SSIZE_T_CLEAN will be required for '#' formats.

now, I have no control over that library, no ability to fix it - nor do I seem to have an easy alternative to using it - and it works fine. So the deprecation warning adds zero value to me - but it interferes with the UI of my tool - as it appears on stdout. Is there any way to suppress it/make it go away?

the way I'm calling it is:

   import pyminizip
   pyminizip.compress_multiple( [ prod_report ], [], f"C:/temp/report{name}.zip", "Password", 9 )
like image 753
Darren Oakey Avatar asked Nov 17 '25 09:11

Darren Oakey


1 Answers

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

got the answer from https://stackoverflow.com/a/879249/15213571

like image 62
mark86v1 Avatar answered Nov 18 '25 21:11

mark86v1



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!