unable to resolve readline issues

Sabrina Almodóvar salmodovar at ligumu.com
Sun Dec 4 18:36:19 EST 2022


On 04/12/2022 17:08, Eryk Sun wrote:
> On 12/2/22, biglee12672 at gmail.com <biglee12672 at gmail.com> wrote:
>>
>> From this point on Python became unusable as I uninstalled rebooted then
>> reinstalled to find I have the same issues as stated.  Finally uninstalled
>> Python as it doesn't perform as usual especially trying to understand the
>> use of pyreadline, gnureadline and or just readline.
> 
> When Python runs interactively, it implicitly tries to import the
> readline module. On POSIX, Python has a builtin readline module that
> usually uses the GNU Readline library.
> 
> On Windows, Python does not include a readline module. Instead, if
> standard I/O is a console, the high-level WinAPI ReadConsoleW()
> function is used, which implements its own line editor and
> command-line history. It's not as general, flexible, or capable as the
> readline interface, so a third-party pyreadline package was
> implemented for Windows. However, as far as I know, pyreadline is no
> longer actively developed. Thus it has out-of-date code, which may be
> broken in newer releases of Python, such as isinstance(x,
> collections.Callable).
> 
> Your choice is to either patch pyreadline to fix the bug or uninstall it.

(*) How to patch it

Open the file

  Lib/site-packages/pyreadline/py3k_compat.py

and locate the procedure

    def callable(x):
        return isinstance(x, collections.Callable)

Change it to

    def callable(x):
        return isinstance(x, collections.abc.Callable)

You're done.


More information about the Python-list mailing list