You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
python.exe on Windows 10 with Python 3.10 errors after this module is installed #73
Please change the code in line 8 of "c:\python\lib\site-packages\pyreadline\py3k_compat.py" to return isinstance(x, collections.abc.Callable), so that it can run successfully.
Reacted by Olaf S., Dmitry Vornychev, yffbit and Howard
Please change the code in line 8 of "c:\python\lib\site-packages\pyreadline\py3k_compat.py" to return isinstance(x, collections.abc.Callable), so that it can run successfully.
Can you create a PR? I deleted the Windows VM I tested this on as I gave up supporting Windows because of this, so I can't easily test such a change. Did you test that on older versions of Python that pyreadline is supposed to support?
$ python
Python 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license"for more information.
Failed calling sys.__interactivehook__
Traceback (most recent call last):
File "C:\Python310\lib\site.py", line 446, in register_readline
import readline
File "C:\Python310\lib\site-packages\readline.py", line 34, in<module>
rl = Readline()
File "C:\Python310\lib\site-packages\pyreadline\rlmain.py", line 422, in __init__
BaseReadline.__init__(self)
File "C:\Python310\lib\site-packages\pyreadline\rlmain.py", line 62, in __init__
mode.init_editing_mode(None)
File "C:\Python310\lib\site-packages\pyreadline\modes\emacs.py", line 633, in init_editing_mode
self._bind_key('space', self.self_insert)
File "C:\Python310\lib\site-packages\pyreadline\modes\basemode.py", line 162, in _bind_key
if not callable(func):
File "C:\Python310\lib\site-packages\pyreadline\py3k_compat.py", line 8, in callable
return isinstance(x, collections.Callable)
AttributeError: module 'collections' has no attribute 'Callable'
after suggested edit in cd C:\Python310\Lib\site-packages\pyreadline\:
$ python
Python 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license"for more information.
>>> if (1):
... <I hit a TAB here>
Readline internal error
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\pyreadline\console\console.py", line 768, in hook_wrapper_23
res = ensure_str(readline_hook(prompt))
File "C:\Python310\lib\site-packages\pyreadline\rlmain.py", line 571, in readline
self._readline_from_keyboard()
File "C:\Python310\lib\site-packages\pyreadline\rlmain.py", line 536, in _readline_from_keyboard
ifself._readline_from_keyboard_poll():
File "C:\Python310\lib\site-packages\pyreadline\rlmain.py", line 556, in _readline_from_keyboard_poll
result = self.mode.process_keyevent(event.keyinfo)
File "C:\Python310\lib\site-packages\pyreadline\modes\emacs.py", line 243, in process_keyevent
r = self.process_keyevent_queue[-1](keyinfo)
File "C:\Python310\lib\site-packages\pyreadline\modes\emacs.py", line 286, in _process_keyevent
r = dispatch_func(keyinfo)
File "C:\Python310\lib\site-packages\pyreadline\modes\basemode.py", line 257, incomplete
completions = self._get_completions()
File "C:\Python310\lib\site-packages\pyreadline\modes\basemode.py", line 200, in _get_completions
r = self.completer(ensure_unicode(text), i)
File "C:\Python310\lib\rlcompleter.py", line 81, incompletereadline.redisplay()
AttributeError: module 'readline' has no attribute 'redisplay'
File "<stdin>", line 2
^
IndentationError: expected an indented block after 'if' statement on line 1
Activity
keeely commentedon Nov 18, 2021
keeely commentedon Nov 22, 2021
FYI, see also: https://bugs.python.org/issue45870
liyiliuxingyu commentedon Dec 1, 2021
Please see this link hylang/hy#2114 (comment).
liyiliuxingyu commentedon Dec 1, 2021
Please change the code in line 8 of "c:\python\lib\site-packages\pyreadline\py3k_compat.py" to return isinstance(x, collections.abc.Callable), so that it can run successfully.
liyiliuxingyu commentedon Dec 1, 2021
Hopefully, the developer will fix the bug
duanqn commentedon Dec 4, 2021
Also hit this issue. Would be nice if someone can fix it.
andy-maier commentedon Dec 12, 2021
I have the same problem, see https://github.com/zhmcclient/zhmccli/runs/4498710188?check_suite_focus=true.
keeely commentedon Dec 14, 2021
Can you create a PR? I deleted the Windows VM I tested this on as I gave up supporting Windows because of this, so I can't easily test such a change. Did you test that on older versions of Python that pyreadline is supposed to support?
eabase commentedon Dec 28, 2021
@liyiliuxingyu
Changing the code as suggested doesn't completely fix it.
It just removes one of the errors, and breaks other things.
eabase commentedon Dec 28, 2021
In powershell:
Before edit:
after suggested edit in
cd C:\Python310\Lib\site-packages\pyreadline\:eabase commentedon Dec 28, 2021
@keeely
In addition to the fix above, you also need to fix this:
You need to edit:
C:\Python310\Lib\site-packages\pyreadline\modes\basemode.py:Adding the code as shown in #64:
Other related issues:
#70
#49
@liyiliuxingyu
With these 2 sets of changes it now works great!
liyiliuxingyu commentedon Jan 3, 2022
eabase commentedon Jan 14, 2022
Having used this hack for a while, I am still unhappy. Command completion seem to fail, and instead of "just failing", it
' 'and you need to hit backspace 4 times to get back where you were.Typing this:

Then hitting TAB once, give me this:

(Using pwsh.exe
7.2.1in Windows Terminal.)Seem like there is a hack in #71
#Override completer from rlcompleter to disable automatic ( on callableGhoreish commentedon Jun 12, 2023
Dears,
I suggest you use the following command to solve the problem: