[AstroPy] PyFITS Too many open files
Sat Jun 15 13:01:38 CDT 2013
Sorry -- I should have read the blip of code better.
So, what version of python and pyfits are you using? How many files are you
What happens if you add 'memmap=False' in each of your pyfits open() lines.
The pyfits mmap stuff is relatively new so maybe there is an issue.
On Sat, Jun 15, 2013 at 11:29 AM, Nicholas Earl <email@example.com> wrote:
> Sorry, but it seems I sent this back to only Nice Nell, and not the entire
> Thanks for the reply. I was under the impression that the with command
> automatically closed the file? Regardless, I went ahead and wrote the
> script up like this
> import pyfits
> for filename in os.listdir(directory):
> kep_id = filename[4:13]
> fits = pyfits.open(directory + "/" + filename, ignore_missing_end=True)
> time = fits.data["TIME"]
> energy = fits.data["ENERGY"]
> Unfortunately, I get the same error.
> Nicholas Earl
> Graduate Research Assistant
> San Diego State University
> On Fri, Jun 14, 2013 at 10:08 PM, Nico Nell <firstname.lastname@example.org> wrote:
>> You need to close the files once you have retrieved the data...
>> See here:
>> On Fri, Jun 14, 2013 at 10:51 PM, Nicholas Earl <email@example.com>wrote:
>>> 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.data["TIME"]
>>> energy = fits.data["ENERGY"]
>>> Any ideas would be greatly appreciated!
>>> Nicholas Earl
>>> Graduate Research Assistant
>>> San Diego State University
>>> AstroPy mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the AstroPy