Repository navigation
Open
Description
The console throw some error when I try to press <Tab> at the beginning of the line.
>>> Readline internal error
Traceback (most recent call last):
File "C:\Users\24658\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pyreadline\console\console.py", line 768, in hook_wrapper_23
res = ensure_str(readline_hook(prompt))
File "C:\Users\24658\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pyreadline\rlmain.py", line 578, in readline
self._readline_from_keyboard()
8p0\LocalCache\local-packages\Python38\site-packages\pyreadline\rlmain.py", line 543, in _readline_from_keyboard
if self._readline_from_keyboard_poll():
File "C:\Users\24658\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pyreadline\rlmain.py", line 563, in _readline_from_keyboard_poll
result = self.mode.process_keyevent(event.keyinfo)
File "C:\Users\24658\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pyreadline\modes\emacs.py", line 243, in process_keyevent
r = self.process_keyevent_queue[-1](keyinfo)
File "C:\Users\24658\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pyreadline\modes\emacs.py", line 286, in _process_keyevent
r = dispatch_func(keyinfo)
File "C:\Users\24658\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pyreadline\modes\basemode.py", line 268, in complete
completions = self._get_completions()
File "C:\Users\24658\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pyreadline\modes\basemode.py", line 210, in _get_completions
r = self.completer(ensure_unicode(text), i)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\lib\rlcompleter.py", line 80, in complete
readline.redisplay()
AttributeError: module 'readline' has no attribute 'redisplay'for this, I edit some source code. There will insert a string filled by space when press at beginning of the line.
- First, open py script named
basemode.py - Second, check
text;
def _get_completions(self):
...
text = ensure_str(''.join(buf[self.begidx:self.endidx]))
if (len(text) == 0):
return
log('complete text="%s"' % ensure_unicode(text))
...- Finally, insert text if
completions
def complete(self, e): # (TAB)
...
if completions:
...
else:
self._bell()
self.insert_text(' ')Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]Press tab at the beginning of the line[/-][+]Press <Tab> at the beginning of the line[/+]japython commentedon Sep 22, 2020
I can resolve the issue, thanks to your article!
eabase commentedon Dec 28, 2021
@empyrealtear
I don't understand what you are editing. (What are we replacing, and where?)
Can you please post better instructions or make a PR?
eabase commentedon Dec 28, 2021
Ok I got it:
You need to edit:
C:\Python310\Lib\site-packages\pyreadline\modes\basemode.py:Adding the code (at above places)