OSError เป็น error class ของ os module raised เมื่อ os-specific function error ตัวอย่าง # foobar.py import os import sys try: for i in range(5): print(i, os.ttyname(i)) except Exception as e: print(e) print(sys.exc_type) รันบน Linux: $ python foobar.py 0 /dev/pts/0 1 /dev/pts/0