[AstroPy] PyFITS Too many open files

Nicholas Earl nchlsearl@gmail....
Fri Jun 14 23:51:09 CDT 2013

Hello everyone,

I'm having an issue with opening and retrieving information for a large
amount of fits files. Mainly, I keep running into a mmap.error: [Errno 24]
Too many open files error. The code I'm using is:

import pyfits

for filename in os.listdir(directory):
 kep_id = filename[4:13]

with pyfits.open(directory + "/" + filename, ignore_missing_end=True) as
 time = fits[1].data["TIME"]
energy = fits[1].data["ENERGY"]

Any ideas would be greatly appreciated!

Nicholas Earl
Graduate Research Assistant
San Diego State University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/astropy/attachments/20130614/55031a93/attachment.html 

More information about the AstroPy mailing list