Removing RuntimeWarning

Fredrik Lundh fredrik at pythonware.com
Sat Jan 14 08:08:04 EST 2006


Lance Ellinghaus wrote:

> When I use os.tempnam() I receive a RuntimeWarning. How can I not have
> that show up?
>
> I know I should not use tempnam() and I will move away from it in the
> near future, but for now I have to use it.

the warnings module lets you add filters to the warnings subsystem. e.g.

    warnings.simplefilter("ignore", RuntimeWarning)

for more detailed filtering, use warnings.filterwarnings.  see the docs for
details: http://docs.python.org/lib/module-warnings.html

</F>






More information about the Python-list mailing list