473,395 Members | 1,631 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to suppress "DeprecationWarning: Old style callback, use cb_func(ok,store) instead"

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.

John Nagle
Feb 3 '07 #1
7 7469
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")

Peter

Feb 3 '07 #2
En Sat, 03 Feb 2007 06:12:33 -0300, Peter Otten <__*******@web.de>
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)

--
Gabriel Genellina

Feb 3 '07 #3
On 2007-02-03, Gabriel Genellina <ga******@yahoo.com.arwrote:
En Sat, 03 Feb 2007 06:12:33 -0300, Peter Otten <__*******@web.de>
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)
Ah, yes! The null module. Python should have more of these. I
mean "shouldn't". ;)

--
Neil Cerutti
Feb 3 '07 #4
Gabriel Genellina wrote:
En Sat, 03 Feb 2007 06:12:33 -0300, Peter Otten <__*******@web.de>
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

Feb 3 '07 #5
Gabriel Genellina wrote:
En Sat, 03 Feb 2007 06:12:33 -0300, Peter Otten <__*******@web.de>
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")
Thanks.

Actually, just copying the message into the string doesn't work; the
matching argument is a regular expression, so "(" has special meaning.
But the general idea is right.

John Nagle
Feb 3 '07 #6
En Sat, 03 Feb 2007 07:35:22 -0300, Peter Otten <__*******@web.de>
escribió:
Gabriel Genellina wrote:
>En Sat, 03 Feb 2007 06:12:33 -0300, Peter Otten <__*******@web.de>
escribió:
>>John Nagle wrote:

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?
The shell parses that line, not Python, so you should look into its
documentation.

If one needs to disable the warning for all scripts, putting a call to
warnings.simplefilter on sitecustomize.py would help (of course, if one is
allowed to edit that file).

--
Gabriel Genellina

Feb 5 '07 #7
"Gabriel Genellina" <ga******@yahoo.com.arwrote:
En Sat, 03 Feb 2007 07:35:22 -0300, Peter Otten <__*******@web.de>
escribió:
>#!/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?
The shell parses that line, not Python, so you should look into its
documentation.
Bzzt! In any modestly recent Unix version (meaning fifteen years
old or younger), it has been the kernel that parsed the #! line,
not the shell.

As for *how* the kernel parses that line, it varies between Unix
versions. Linux, at least versions 2.4 and 2.6, takes everything
after the interpreter and passes it as a single argument to the
interpreter, with leading and trailing whitespace stripped. Thus

#! /usr/bin/interpreter foo bar gazonk del

will give the parameter "foo bar gazonk del" to the interpreter.

SunOS 5.10 (aka Solaris 10) on the other hand, splits the line on
whitespace and passes only the first word as parameter, and would
thus give only "foo" to the interpreter for the same #! line.

I seem to remember having used some Unix flavor that allowed
multiple words as arguments, and thus passed the four words
"foo", "bar", "gazonk" and "del" as arguments for the above #!
line, but I don't remember what Unix that was.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
"Adde parvum parvo magnus acervus erit" ! bellman @ lysator.liu.se
(From The Mythical Man-Month) ! Make Love -- Nicht Wahr!
Feb 6 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

52
by: Markus Elfring | last post by:
How much are you interested that the attribute "style" will offer the same or similar capabilities like they are provided by the element "style" in the element "head"? Do you want that the...
5
by: johnsuth | last post by:
I want to produce a trivial demonstration of dynamic modification. I thought that pressing a button might change its color. I studied O'Reillys books and successfully created the button with a...
14
by: I_AM_DON_AND_YOU? | last post by:
Hello all: Yesterday I put this post regarding the query as to how to open a new form in "modal" style. I am calling the form in the following way: dim frm as form2() frm = new form2()...
2
by: mstearne | last post by:
Has anyone seen any Javascript that mimics the effect that allows you to browse through the New Releases, Just Added sections of the iTunes Music Store? Where you click the arrow icon and the next...
1
by: awebguynow | last post by:
OK, I'm on the bandwagon, to mimic Google Suggest At this point I'm just trying to place my div in the right x, y spot. newdiv.setAttribute("style", "position:absolute;left:"+x+";top:"+y);...
3
by: bulwark_jrm | last post by:
I'm trying to duplicate functionality found in a Windows application at one of my clients. Essentially, another programmer was able to arrange a lot of search options into a single dialog box by...
2
by: SAL | last post by:
I have the following line of code in my Page_Load Event of my ASP.net page: txtExplanationofChange.Attributes.Add ("style","overflow :hidden"); which allows me to can turn off the Scrollbar of my...
1
by: George Ter-Saakov | last post by:
I am trying to set class property of the radio button. but no mater what i do .NET moves it to <SPANtag aroung that radio button. So my <asp:RadioButton id="chkAllUpdates" cssClass="radio"...
15
oll3i
by: oll3i | last post by:
i'm writing javascript validator and i change input font color when the input is incorrect but i want this input font color to be changed back when the input is correct i cannot do eg var...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.