prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.11k stars 718 forks source link

Python version 3.11 is currently not supported. #1727

Closed AliYmn closed 1 year ago

AliYmn commented 1 year ago

Hello, we are getting error about "Python version 3.11 is currently not supported" when use autocomplete with "tab shortcut".

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/jedi/cache.py", line 109, in wrapper
    return dct[key]
           ~~~^^^^^
KeyError: ((), frozenset())

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/parso/grammar.py", line 246, in load_grammar
    return _loaded_grammars[path]
           ~~~~~~~~~~~~~~~~^^^^^^
KeyError: '/usr/local/lib/python3.11/site-packages/parso/python/grammar311.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/parso/grammar.py", line 249, in load_grammar
    with open(path) as f:
         ^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.11/site-packages/parso/python/grammar311.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/IPython/core/completer.py", line 3147, in _complete
    result = matcher(context)
             ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/IPython/core/completer.py", line 2199, in _jedi_matcher
    matches = self._jedi_matches(
              ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/IPython/core/completer.py", line 2253, in _jedi_matches
    interpreter = jedi.Interpreter(text[:offset], namespaces)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jedi/api/__init__.py", line 858, in __init__
    super(Interpreter, self).__init__(code, environment=environment,
  File "/usr/local/lib/python3.11/site-packages/jedi/api/__init__.py", line 184, in __init__
    self._inference_state = InferenceState(
                            ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jedi/inference/__init__.py", line 91, in __init__
    self.grammar = environment.get_grammar()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jedi/cache.py", line 111, in wrapper
    result = method(self, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jedi/api/environment.py", line 37, in get_grammar
    return parso.load_grammar(version=version_string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/parso/grammar.py", line 260, in load_grammar
    return load_grammar(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/parso/grammar.py", line 256, in load_grammar
    raise NotImplementedError(message)
NotImplementedError: Python version 3.11 is currently not supported.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/IPython/terminal/ptutils.py", line 122, in get_completions
    yield from self._get_completions(body, offset, cursor_position, self.ipy_completer)
  File "/usr/local/lib/python3.11/site-packages/IPython/terminal/ptutils.py", line 138, in _get_completions
    for c in completions:
  File "/usr/local/lib/python3.11/site-packages/IPython/core/completer.py", line 835, in _deduplicate_completions
    completions = list(completions)
                  ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/IPython/core/completer.py", line 2803, in completions
    for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
  File "/usr/local/lib/python3.11/site-packages/IPython/core/completer.py", line 2858, in _completions
    results = self._complete(
              ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/IPython/core/completer.py", line 3154, in _complete
    sys.excepthook(*sys.exc_info())
  File "/usr/local/lib/python3.11/site-packages/IPython/core/application.py", line 284, in excepthook
    return self.crash_handler(etype, evalue, tb)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/IPython/core/crashhandler.py", line 163, in __call__
    if rptdir is None or not Path.is_dir(rptdir):
                             ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/pathlib.py", line 1250, in is_dir
    return S_ISDIR(self.stat().st_mode)
                   ^^^^^^^^^
AttributeError: 'str' object has no attribute 'stat'
AliYmn commented 1 year ago

I solved the problem by upgrading the packages I mentioned below.