OSError: [Errno 24] Too many open files - OS Mojave

≡放荡痞女 提交于 2021-01-27 05:38:46

问题


So, I'm writing a script to take a certain dataset, sample it 100 times using different random seeds, completing all these datasets and then getting the mean error. However, whenever I try to run the script I end up with the error OSError: [Errno 24] Too many open files

I don't understand what I can do to fix this (if I should do something in the script or in to the system and what). I'm using Python 3 with macOS Mojave. Anybody has a clue?


回答1:


The number of open files you're allowed can be increased by using ulimit e.g. in bash you could do: ulimit -n This will probably print out 256 meaning that at one time a maximum of 256 file descriptors are allowed to be open.

Increase the limit: ulimit -n 30000 # 30,000 open files allowed

This sort of thing is generally done on systems running something like server programs that need a file descriptor (a socket descriptor) for each concurrent connection being handled.

However, if you post the code there might be another way to fix this. It doesn't sound like you want/need multiple file descriptors open at the same time.



来源:https://stackoverflow.com/questions/56843659/oserror-errno-24-too-many-open-files-os-mojave

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!