You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Removing Python 3 ResourceWarning: unclosed file warnings may need AstroPy change #365
I've been looking into whether we can remove the ResourceWarning filters we have in sherpa/conftest.py that were added in the Python 3 conversion. Some of these are being created by AstroPy and bubble up into Sherpa (due to the "interesting" way we deal with file I/O and throw a kitchen-sink of read routines at a file until one sticks). Here's an example of the issue, using AstroPy 1.3.3 and Python 3.5:
% cat dummy.dat
# A B
0.5 1.65
% cat dummy.py
import warnings
from astropy.io import fits
warnings.simplefilter(action='error', category=ResourceWarning)
try:
fits.open('dummy.dat')
except OSError as e:
print("--> {}".format(e))
%
Activity
DougBurke commentedon Jun 8, 2017
See astropy/astropy#6168
DougBurke commentedon Aug 30, 2017
With astropy 2.0.1 (on Python 3.6) I no-longer get a warning:
DougBurke commentedon May 18, 2018
I think this can be closed now.