Gabriel Genellina wrote: > En Sat, 03 Feb 2007 06:12:33 -0300, Peter Otten <[EMAIL PROTECTED]> > escribió: > >> John Nagle wrote: >> >>> How do I suppress "DeprecationWarning: Old style callback, use >>> cb_func(ok, >>> store) instead". A library is triggering this message, the library is >>> being fixed, but I need to make the message disappear from the output >>> of a >>> CGI program. >> >> import warnings >> warnings.filterwarnings("ignore", message="Old style callback, use >> cb_func(ok, store) instead") > > Or you can be more aggressive and filter out all DeprecationWarnings: > warnings.simplefilter("ignore",DeprecationWarning) > (same as using option -Wignore::DeprecationWarning on the python command > line)
The latter might be interesting for a cgi. I didn't mention it because I didn't get it to work with my test case (importing sre) and Python's cgi server. Trying again, I found that you must not quote the -W argument. #!/usr/local/bin/python2.5 -Wignore:The sre module is deprecated, please import re. >From that follows that you can pass at most one commandline arg. If you are using #!/usr/bin/env python2.5 python2.5 will be that single argument and no options are possible at all. What might be the reasons for such a seemingly arbitrary limitation? Peter -- http://mail.python.org/mailman/listinfo/python-list