"Too many open files" error

55 views
Skip to first unread message

Caroline Alexander

unread,
Apr 22, 2016, 12:30:13 PM4/22/16
to SunPy
Hi everyone,

I was wondering if anyone has encountered (and fixed!) an issue I'm having with SunPy. I have a directory with 1600 AIA fits files (these have already been subarrayed so I don't think it's a memory issue) and I'm using: 

dirname='AIA304files_b'

mc=list()
for filename in sorted(os.listdir(dirname)):
   if '.fits' in filename:
      file=os.path.join(dirname,filename)
      print file
      md=sunpy.map.Map(file)
      mc.append(md)

But after 1015 files it crashes out and says "OSError: [Errno 24] Too many open files". I'm using a mac and my colleagues on Linux have encountered the same problem. The code works fine if you use less files.

The issue seems to be with the md=sunpy.map.Map(file) line.... maybe it's unable to close the files properly??

Any advice or thoughts would be appreciated as I'm hoping to use SunPy on large file numbers.

Cheers,

Caroline


Jack Ireland

unread,
Apr 22, 2016, 12:35:38 PM4/22/16
to su...@googlegroups.com
This can be fixed by changing defaults on your system.  Look up the man page for ulimit on your OS.  You can change the number of open files there.

Although that will allow you to do what you want to do, there may be a bug somewhere in SunPy - perhaps files are not being closed properly???



--
You received this message because you are subscribed to the Google Groups "SunPy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sunpy+un...@googlegroups.com.
To post to this group, send email to su...@googlegroups.com.
Visit this group at https://groups.google.com/group/sunpy.
For more options, visit https://groups.google.com/d/optout.

Shih, Albert Y. (GSFC-6710)

unread,
Apr 22, 2016, 12:40:47 PM4/22/16
to su...@googlegroups.com
Hi, all,
     I'll bring up these two issues (at the time, they seemed to be specific to Windows):


I haven't revisited this issue for a long time, but it's possibly (still) a bug with Astropy.

Albert

Jack Ireland

unread,
Apr 22, 2016, 12:46:21 PM4/22/16
to su...@googlegroups.com
There is a Astropy thread out there mentioning this

https://mail.scipy.org/pipermail/astropy/2013-June/002528.html

jack

Shih, Albert Y. (GSFC-6710)

unread,
Apr 23, 2016, 6:19:32 PM4/23/16
to su...@googlegroups.com

Hi, all,

     I’ve created an issue to continue this discussion:

 

https://github.com/sunpy/sunpy/issues/1745

 

Albert

Reply all
Reply to author
Forward
0 new messages