-#! /usr/bin/python
+#! /usr/bin/python3
-import sys
-import os
import fcntl
+import os
+import sys
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