help with warning formatting
jasmin at soton.ac.uk
jasmin at soton.ac.uk
Fri Mar 11 09:31:25 EST 2005
> import warnings
> warnings.warn('foo')
>
> % python t.py
> t.py:2: UserWarning: foo
> warnings.warn('foo')
>
> Is there a way to just issue the warning message itself, or to at
least
> suppress printing the line where the warning occurred ("
> warnings.warn('foo')" in the example)?
In case anyone else is searching for a solution to this the following
sort of works in Python 2.1:
warnings.warn_explicit('foo', UserWarning, '', '')
:: UserWarning: foo
I'm new to Python so if there is a better way to do this please let me
know.
Jasmin
More information about the Python-list
mailing list