diff --git a/pyqtgraph/__init__.py b/pyqtgraph/__init__.py index 2db79985..b1aa98aa 100644 --- a/pyqtgraph/__init__.py +++ b/pyqtgraph/__init__.py @@ -369,8 +369,12 @@ def exit(): ## close file handles if sys.platform == 'darwin': for fd in range(3, 4096): - if fd not in [7]: # trying to close 7 produces an illegal instruction on the Mac. + if fd in [7]: # trying to close 7 produces an illegal instruction on the Mac. + continue + try: os.close(fd) + except OSError: + pass else: os.closerange(3, 4096) ## just guessing on the maximum descriptor count..