New submission from keeely <smh@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@bugs.python.org>
<https://bugs.python.org/issue45870>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.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@bugs.python.org>
<https://bugs.python.org/issue45870>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com