matplotlib - IOError "Too many open files" while using savefig() in a loop -


i have little issue matplotlib. while trying save figures in loop hundred times savefig(), ends following error:

ioerror: [errno 24] many open files: 'test_421.png' 

i have checked close every figure after saving it, doesn't seem efficient.

here code sample illustrate how error:

def displayfig(input, display, savepath):     fig = plt.figure(figsize=(22, 5))     # add subplots, axis , colorbars...     if display:         plt.show()     else:         plt.savefig(savepath, dpi = 100)     plt.close(fig)  i, inp in enumerate(inparray):     savepath = 'test_%d.png' %     displayfig(inp, false, savepath) 

why error raised? multi-threading issue or memory leak?

try upgrading version of matplotlib. believe matplotlib v1.2.0 addressed (by pr https://github.com/matplotlib/matplotlib/issues/1466/).


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -