Last active
August 29, 2015 14:10
-
-
Save andrewspiers/119f00fc788476c2fe1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import logging | |
import logging.handlers | |
import sys | |
import tempfile | |
logger = logging.getLogger() | |
handler = logging.handlers.SysLogHandler(address=('/dev/log')) | |
logger.addHandler(handler) | |
l = list() | |
for i in range(50000): | |
try: | |
l.append(tempfile.TemporaryFile()) | |
except OSError: | |
del(l) # free up file handles. | |
msg = str(i) + " files could be opened." | |
print(msg) | |
logger.info(msg) | |
logger.critical(msg) | |
sys.exit() | |
print(u'\r', end="") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment