This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author piwi
Recipients agthorr, loewis, mwh, piwi
Date 2021-05-13.07:34:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1620891281.58.0.965785030498.issue512981@roundup.psfhosted.org>
In-reply-to
Content
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))
History
Date User Action Args
2021-05-13 07:34:41piwisetrecipients: + piwi, mwh, loewis, agthorr
2021-05-13 07:34:41piwisetmessageid: <1620891281.58.0.965785030498.issue512981@roundup.psfhosted.org>
2021-05-13 07:34:41piwilinkissue512981 messages
2021-05-13 07:34:41piwicreate