I am getting warnings like these when running numpy on reasonably large pipeline.
RuntimeWarning: invalid value encountered in true_divide
RuntimeWarning: invalid value encountered in greater
How do I find where they are occurring in the code besides writing dozens of print statements?
Python 2.7 and numpy 1.8.1
One way is to convert the warnings to errors:
import warnings
warnings.simplefilter('error', RuntimeWarning)
Then the traceback will tell you where the error occurred.
Thanks to @Graham501617 for the following tip:
This can be done without code changes using the python cli:
python -Werror my_script.py
See the Python documentation for more information.