473,240 Members | 1,608 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,240 software developers and data experts.

clearing all warning module caches in a session

Hi all,

I just started using the warnings module in Python 2.5.2. When I
trigger a warning using the default warning options, an entry is created
in a module-level cache so that the warning is ignored in the future.
However, I don't see an easy way to clear or invalidate these
module-level caches of previously triggered warnings. That means that
if I ever have a warning triggered with a "once" or a default warning
level or filter, I can never see that warning again until I restart
python (or figure out what module contains the cache and delete it

I thought resetwarnings would invalidate the module-level caches, so
that I could trigger a "once" warning, then do resetwarnings() and make
the default an "always" action and see my warning displayed again. At
least, the name seems to indicate that all *warnings* would be reset,
not just the filter list. But apparently resetwarnings() just clears
the filter list, which is helpful, but doesn't do anything for the
already-cached warnings.

A very small change in the code would make this possible. Instead of
making the value of the warnings module-level cache just "1", make it an
integer which is incremented each time resetwarnings() is called. That
way calling resetwarnings() can invalidate the cache (i.e., the warnings
processing would ignore the cache record if the value wasn't the current

Again, the question is: is there an easy way to invalidate all the
module-level caches of warnings so that the entire warning system is
truly reset?



Jul 26 '08 #1
0 921

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

Similar topics

by: Rea | last post by:
Hi! I've searched high and low for this on the net but stil haven't found an answer. I'm trying to install both postnuke and xoops on a win2k server with php 4.3.3. and mysql installed. ...
by: JJ_377 | last post by:
In a "Save and Quit" button on my web app form (aspx), I have the following code that is supposed to clear a session variable (an user id) and redirect to a logon page: Session.Clear()...
by: Floris van Haaster | last post by:
Hi All! I have a question, i have a web application and I store some member information in a variable i declared in a module like: Public some_info_variable as string in module1.vb But...
by: Shaun | last post by:
Hi all, I'm trying to implement a custom session handler that writes session data to a MySQL database. It works fine about 99% of the time. Trouble is, at random intervals, I get entries like...
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache...
by: Manish | last post by:
PHP INI File Setting ------------------------------------------------------------------------------------------------------------------ error_reporting = E_ALL & ~E_NOTICE No warning message are...
by: =?Utf-8?B?R2Vv?= | last post by:
Hi, I use lots of sessions. I want to clear the unwanted sessions when I leave a page. I cant use ViewState as it will slow down the pages. Could some one help me on this?
by: Rafe | last post by:
Hi, This seems to be an old question, and I've read back a bit, but rather than assume the answer is "you can't do that", I'd thought I'd post my version of the question along with a...
by: anithaapr05 | last post by:
After the session end i try to write the session value.In this, it write the session value after the session end, but i got the warning in application event. My asp code: void...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.