[Numpy-discussion] How do I make numpy raise exceptions instead of print warnings?

Roy H. Han starsareblueandfaraway at gmail.com
Mon Mar 31 01:59:35 EDT 2008


Thank you, Robert!  numpy.seterr() is very helpful.  It is just what I needed.

numpy.seterr(all = 'raise') forces numpy to raise exceptions instead
of printing warnings.

[begin quote]
numpy.seterr(all = None, divide = None, over = None, under = None,
invalid = None)
Valid values for each type of error are the strings "ignore", "warn",
"raise", and "call".
[end quote]


Date: Sat, 29 Mar 2008 17:05:42 -0500
From: "Robert Kern" <robert.kern at gmail.com>

On Sat, Mar 29, 2008 at 4:25 PM, Roy H. Han <rhh2109 at columbia.edu> wrote:
> Is there a way to have numpy raise exceptions instead of printing
>  warnings?  The printed warnings make debugging hard.

numpy.seterr()

Read the docstring for the various options.

--
Robert Kern



More information about the NumPy-Discussion mailing list