[AstroPy] Capturing pyfits warnings

jtaylor2@stsc... jtaylor2@stsc...
Wed Sep 15 09:06:21 CDT 2010


Tom,

   I am not sure I understand exactly what is going on here, but if having the warnings module issue exceptions instead of warnings is causing another warning to be raised as an exception that you would like to remain as a warning, you can fix this by using filterwarnings and supplying a regular expression that matches just the warning that you want raised as an exception.  In your case something like:

warnings.filterwarnings('error',message='.*Warning:  File may have been.*"')

   If you contact me directly at jtaylor2@stsci.edu with more details, especially if you can point me to a fits file that is causing the problem, I may be able to be of more help.

     Jim T.


More information about the AstroPy mailing list