◐ Shell
clean mode source ↗

Message 393561 - Python tracker

A workaround consists in replacing fd(0) with /dev/tty without modifying sys.stdin


import os

stdin = os.dup(0)
os.close(0)
tty = os.open("/dev/tty", os.O_RDONLY)
assert tty == 0

import readline
print("input:", input())
print("in:", os.read(stdin, 128))