[SciPy-user] "catching warnings"
Stefan van der Walt
stefan at sun.ac.za
Tue Sep 19 07:40:50 CDT 2006
On Tue, Sep 19, 2006 at 10:59:49AM +0200, Christian Meesters wrote:
> In some cases calling interpolate.splrep results in the following warning:
> Warning: The required storage space exceeds the available strorage space.
> Probably causes: nest to small or s is too small. (fp>s)
> That's a really nice information to prevent the user from making more serious
> I'm now trying to use the function in combination with some GUI-code. In my
> particular case, smoothing some curves might make sense. For pysical reasons
> it only makes sense, if the user applies only a small smoothing factor. Yet,
> I'd like to inform the user in case she / he is overdoing it, but have no
> chance to calculate a good factor in advance, because this is dataset
> dependend. Anyway, I should certainly inform the user about this warning.
> Is there a way to "catch" this warning, almost like an exception?
You can change warnings into exceptions, afaik. Take a look at the
Python documentation on warning filters at
More information about the SciPy-user