この記事を見ながらTAB補完を有効にしました
TAB補完は可能になりましたが、何もないところでTABを押すと以下のエラーが表示されるようになりました
python
1Traceback (most recent call last): 2 File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pyreadline\console\console.py", line 768, in hook_wrapper_23 3 res = ensure_str(readline_hook(prompt)) 4 File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pyreadline\rlmain.py", line 571, in readline 5 self._readline_from_keyboard() 6 File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pyreadline\rlmain.py", line 536, in _readline_from_keyboard 7 if self._readline_from_keyboard_poll(): 8 File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pyreadline\rlmain.py", line 556, in _readline_from_keyboard_poll 9 result = self.mode.process_keyevent(event.keyinfo) 10 File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pyreadline\modes\emacs.py", line 243, in process_keyevent 11 r = self.process_keyevent_queue[-1](keyinfo) 12 File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pyreadline\modes\emacs.py", line 286, in _process_keyevent 13 r = dispatch_func(keyinfo) 14 File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pyreadline\modes\basemode.py", line 257, in complete 15 completions = self._get_completions() 16 File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pyreadline\modes\basemode.py", line 200, in _get_completions 17 r = self.completer(ensure_unicode(text), i) 18 File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\rlcompleter.py", line 80, in complete 19 readline.redisplay() 20AttributeError: module 'readline' has no attribute 'redisplay'
ドキュメントには、以下のように書いてありました
readline.redisplay()
スクリーンの表示を変更して行バッファの現在の内容を反映させます。これにより下層のライブラリーの
rl_redisplay() が呼ばれます。
GNU Readlineのドキュメントには以下のように書いてありました
rl_redisplay ()
Change what's displayed on the screen to reflect the current contents ofrl_line_buffer
.
和訳)画面に表示される内容を変更して、rl_line_buffer
の現在の内容を反映させます。
ですが、正直この関数がどういった働きを持つのかよくわかりませんでした。
UbuntuのPythonでredisplay()を実行しましたが、何かが起こったようには見えませんでした。
現在、pyreadlineの先頭に以下を追加することでエラーを回避しています
python
1redisplay = lambda: None
ですが、どうしても無理矢理な感じが否めません
- readline.redisplay()はどういった機能を持っているのですか?
- pyreadlineにreadline.redisplay()の代わりになる関数はありますか?
環境は以下のとおりです
- Windows 10 1909 64bit
- Python 3.8.3 (64bit)
- pyreadline 2.1
回答よろしくおねがいします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/05/30 13:31