-#! /usr/bin/python
+#! /usr/bin/python3
import fcntl
import os
import termios
try:
- tty = open('/dev/tty')
- fcntl.ioctl(tty, termios.TIOCNOTTY)
- tty.close()
+ with open('/dev/tty') as tty:
+ fcntl.ioctl(tty, termios.TIOCNOTTY)
except IOError:
pass