[New-bugs-announce] [issue45870] There's no readline module on Windows Python (cmd.Cmd)
keeely
report at bugs.python.org
Mon Nov 22 08:51:22 EST 2021
New submission from keeely <smh at sophos.com>:
In the past this was worked around by installing a third-party module:
https://github.com/pyreadline/pyreadline
For Python 3.10, however this module doesn't work. And pyreadline doesn't seem to be maintained anymore, so it's possible it won't get fixed.
https://github.com/pyreadline/pyreadline/issues/73
Consider the following code:
import cmd
import readline
open("history.txt", "w").write("first line\nsecond line\n")
readline.clear_history()
readline.read_history_file("history.txt")
class MyShell(cmd.Cmd):
def __init__(self):
super().__init__()
shell = MyShell()
shell.cmdloop()
This works fine on MacOs Python, also on Linux and on Windows prior to 3.10 with the readline module added. It won't work going forward.
The Windows cmd implementation clearly uses readline or some compatible lib under the hood, so Python should make it available to developers.
----------
components: Library (Lib)
messages: 406778
nosy: keeely
priority: normal
severity: normal
status: open
title: There's no readline module on Windows Python (cmd.Cmd)
type: behavior
versions: Python 3.10
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45870>
_______________________________________
More information about the New-bugs-announce
mailing list