There seems to be lots of questions on this topic bit I can't seem to find what exactly I should call inside my python script to increase the open file limit ? I know that I need to use the _setmaxstdio on C level but I am not sure how to call it in python. Any ideas ?
Asked
Active
Viewed 917 times
2
Cemre Mengü
- 16,738
- 25
- 102
- 161
-
Isn't @NorthCat answer OK? If yes, please mark it as so. Also: https://stackoverflow.com/questions/6774724/why-python-has-limit-for-count-of-file-handles. – CristiFati Apr 05 '20 at 20:33
2 Answers
0
One more solution with the built-in ctypes library:
import ctypes
print("Before: {}".format(ctypes.windll.msvcrt._getmaxstdio()))
ctypes.windll.msvcrt._setmaxstdio(2048)
print("After: {}".format(ctypes.windll.msvcrt._getmaxstdio()))
ababak
- 1,552
- 1
- 10
- 23