Configure IPython to display warnings all the time
The first time I do something that triggers a warning in the IPython shell, I see this. But in later times, I don't. For example,
In [1]: import numpy as np
In [2]: np.uint8(250) * np.uint8(2)
/Users/me/anaconda/envs/py33/bin/ipython:1: RuntimeWarning: overflow encountered in ubyte_scalars
#!/bin/bash /Users/me/anaconda/envs/py33/bin/python.app
Out[2]: 244
In [3]: np.uint8(250) * np.uint8(2)
Out[3]: 244 # No warning!
How can I configure IPython to display warnings? I tried:
import warnings
warnings.filterwarnings('always')
But it doesn't really matter.
+3
source to share
1 answer
I think this was covered relatively recently by the IPython team. It was bad with warnings
a somewhat unusual design decision. Turing is always
not enough for me in plain Python, and now if I do the same in the IPython backbone:
In [1]: import warnings
In [2]: warnings.filterwarnings('always')
In [3]: import numpy as np
In [4]: np.uint8(250) * np.uint8(2)
/home/dsm/sys/root/bin/ipython3.4:1: RuntimeWarning: overflow encountered in ubyte_scalars
#!/home/dsm/sys/root/bin/python3.4
Out[4]: 244
In [5]: np.uint8(250) * np.uint8(2)
/home/dsm/sys/root/bin/ipython3.4:1: RuntimeWarning: overflow encountered in ubyte_scalars
#!/home/dsm/sys/root/bin/python3.4
Out[5]: 244
+2
source to share