import warnings, io, os #import _pyio as io warnings.simplefilter('default') fd = os.open('/dev/tty', os.O_RDWR|os.O_NOCTTY) try: tty = io.open(fd, 'w+', 1) tty.close() except io.UnsupportedOperation: pass