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): def setMaxfilesopened(limit):
try: try:
if sys.platform == "win32": if sys.platform == "win32":
import win32file import ctypes
maxstdio = win32file._getmaxstdio() maxstdio = ctypes.cdll.msvcr100._getmaxstdio()
if maxstdio < limit: if maxstdio < limit:
logging.debug("Current maxstdio: %s, changing to %s..." % (maxstdio, limit)) logging.debug("Current maxstdio: %s, changing to %s..." % (maxstdio, limit))
win32file._setmaxstdio(limit) ctypes.cdll.msvcr100._setmaxstdio(limit)
return True return True
else: else:
import resource import resource