[SciPy-user] "catching warnings"
rclewley at cam.cornell.edu
Tue Sep 19 16:49:01 CDT 2006
The situation is worse than that. Some of the print statements are
actually in legacy Fortran code that is wrapped as DLLs, e.g. the VODE
integrator in odepack.py.
This is quite unfortunate when it comes to using these modules as part of
more sophisticated algorithms, for which more control over the output to
the user or internal detection of problems is desired. The idea of legacy
code in this context is not to have to change it and then worry about
providing the edited source with your distribution, etc....
So I'm considering an exploration of whether I can suppress output to
stdout or stderr in a simple and platform-independent way when I call DLLs
like VODE, and then have my code reconstruct information about the
warnings from the verbose output options that many of those codes have.
Does anyone have any experience of trying this?
On Tue, 19 Sep 2006, A. M. Archibald wrote:
> On 19/09/06, Stefan van der Walt <stefan at sun.ac.za> wrote:
>> You can change warnings into exceptions, afaik. Take a look at the
>> Python documentation on warning filters at
> Unfortunately, they're not warnings at all, they're just print
> statements - so not only can you not control them, they appear on
> stdout (and not stderr), contaminating the output of your program.
> This is far from the only module that does this, either (for example,
> odepack.py. quadrature.py, optimize.py... grepping for "print" should
> turn them up)
Department of Mathematics
and Center for Applied Mathematics
Ithaca, NY 14853
More information about the SciPy-user