Change maxstdio using ctypes as win32file module is not included with Python3 by default

This commit is contained in:
shortcutme 2019-07-18 03:31:57 +02:00
parent d3e8fcea47
commit 6cffa1c0ca
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -5,11 +5,11 @@ import logging
def setMaxfilesopened(limit):
try:
if sys.platform == "win32":
import win32file
maxstdio = win32file._getmaxstdio()
import ctypes
maxstdio = ctypes.cdll.msvcr100._getmaxstdio()
if maxstdio < limit:
logging.debug("Current maxstdio: %s, changing to %s..." % (maxstdio, limit))
win32file._setmaxstdio(limit)
ctypes.cdll.msvcr100._setmaxstdio(limit)
return True
else:
import resource