Dear all,

I am trying to turn Python warnings to errors, but it does not work as
expected with numpy. The following two piece of code work:

$ python -W error -c 'import warnings; import numpy;
warnings.warn("test", numpy.core.numeric.ComplexWarning)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
numpy.core.numeric.ComplexWarning: test

$ python -W error -c 'import warnings; import numpy; raise
numpy.core.numeric.ComplexWarning'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
numpy.core.numeric.ComplexWarning

while this does not (i.e. still produces just a warning):

$ python -W error -c 'import numpy; x=numpy.ones(2); x+=1j'
numpy.core.numeric.ComplexWarning: Casting complex values to real
discards the imaginary part

This is with Python 2.6.6 and numpy 1.5.1, but also confirmed with Python 2.7.

Thanks for any suggested solutions,
Ondrej Marsalek
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to