- , stdin python script. , tty Python tty, sys.stdin .
import sys, os
tty_path = os.popen('tty', 'r').read().strip()
sys.stdin = open(tty_path, 'r')
, , .
EDIT:
. . - TTY script. :
import sys, os
tty_path = os.environ['TTY']
sys.stdin = open(tty_path, 'r')
script :
TTY=`tty` python < source.py
, , - - script python stdin python source.py.