title: Python finding stdin filepath on Linux
body: <p>How can I tell the file (or tty) that is attached to my stdios? </p>
  
  <p>Something like:</p>
  
  <pre><code>&gt;&gt;&gt; import sys
  &gt;&gt;&gt; print sys.stdin.__path__
  '/dev/tty1'
  &gt;&gt;&gt;
  </code></pre>
  
  <p>I could look in proc:</p>
  
  <pre><code>import os, sys
  os.readlink('/proc/self/fd/%s' % sys.stdin.fileno())
  </code></pre>
  
  <p>But seems like there should be a builtin way?</p>