title: Get the path of the current TTY in Python
body: <p>How do you get the device path for the current TTY?</p>
  
  <p>Python has <code>sys.stdin</code>, <code>sys.stdout</code> and <code>os.ttyname</code> but you cannot pass either of the formers to the latter because it requires a file descriptor.</p>