Is it possible to display line number along with warnings? I’m getting some warnings, possibly from numpy, but I have no idea where they come from. I don’t want my code to aboard or to raise an exception, but I’d like to get more information from the origin of the warnings. Is it something possible?
Is it possible to display line number along with warnings? I’m getting some warnings,
Share
Warnings that are issued via the
warningsmodule are by default printed including file name and line number, and the output can be controlled by the functions in thewarningsmodule as well as by the-Wparameter to the Python interpreter. Since your warnings apparently don’t include file name and line number, thewarningsmodule probably won’t help you. Since you suspect thatnumpymight be the culprit, I suggest having a look at thenumpy.seterr()function. Maybe turning warnings into errors helps.