Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'get_document' in Kate text editor #545

Open
5ynCity opened this issue Mar 29, 2024 · 1 comment

Comments

@5ynCity
Copy link

5ynCity commented Mar 29, 2024

I tried to set up LSP for Kate using the install commands provided in the readme. But after installing, the Kate console shows this when loading a script. (In this case it's a completely blank script). Then the last error is repeated with almost every single character typed.

[14:49:23  LSP Client Log] Started server python@/home/cyan: /usr/bin/pylsp --check-parent-process
[14:49:23  LSP Server Log] python@/home/cyan
2024-03-29 14:49:23,119 EDT - WARNING - pylsp.config.config - Failed to load pylsp entry point 'autopep8': No module named 'pycodestyle'
[14:49:23  LSP Server Log] python@/home/cyan
2024-03-29 14:49:23,121 EDT - WARNING - pylsp.config.config - Failed to load pylsp entry point 'pycodestyle': No module named 'pycodestyle'
[14:49:23  LSP Server Log] python@/home/cyan
2024-03-29 14:49:23,121 EDT - WARNING - pylsp.config.config - Failed to load pylsp entry point 'pydocstyle': No module named 'pydocstyle'
2024-03-29 14:49:23,125 EDT - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request 1
Traceback (most recent call last):
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 117, in consume
    self._handle_request(message['id'], message['method'], message.get('params'))
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 197, in _handle_request
    handler_result = handler(params)
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
    return method(**(params or {}))
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 210, in m_initialize
    self.config = config.Config(rootUri, initializationOptions or {},
  File "/usr/lib/python3/dist-packages/pylsp/config/config.py", line 52, in __init__
    entry_point.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2465, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2471, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3/dist-packages/pylsp/plugins/pyflakes_lint.py", line 18, in 
    messages.ContinueInFinally,
AttributeError: module 'pyflakes.messages' has no attribute 'ContinueInFinally'
[14:49:23  LSP Server Log] python@/home/cyan
2024-03-29 14:49:23,140 EDT - ERROR - pylsp_jsonrpc.endpoint - Failed to handle notification initialized: {}
Traceback (most recent call last):
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 146, in _handle_notification
    handler_result = handler(params)
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
    return method(**(params or {}))
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 252, in m_initialized
    self._hook('pylsp_initialized')
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 155, in _hook
    hook_handlers = self.config.plugin_manager.subset_hook_caller(hook_name, self.config.disabled_plugins)
AttributeError: 'NoneType' object has no attribute 'plugin_manager'
[14:49:23  LSP Server Log] python@/home/cyan
2024-03-29 14:49:23,141 EDT - ERROR - pylsp_jsonrpc.endpoint - Failed to handle notification textDocument/didOpen: {'textDocument': {'languageId': 'python', 'text': '', 'uri': 'file:///home/cyan/Scripts/auto.py', 'version': 30}}
Traceback (most recent call last):
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 146, in _handle_notification
    handler_result = handler(params)
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
    return method(**(params or {}))
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 326, in m_text_document__did_open
    workspace.put_document(textDocument['uri'], textDocument['text'], version=textDocument.get('version'))
AttributeError: 'NoneType' object has no attribute 'put_document'
2024-03-29 14:49:23,141 EDT - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request 2
Traceback (most recent call last):
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 117, in consume
    self._handle_request(message['id'], message['method'], message.get('params'))
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 197, in _handle_request
    handler_result = handler(params)
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
    return method(**(params or {}))
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 362, in m_text_document__document_symbol
    return self.document_symbols(textDocument['uri'])
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 275, in document_symbols
    return flatten(self._hook('pylsp_document_symbols', doc_uri))
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 154, in _hook
    doc = workspace.get_document(doc_uri) if doc_uri else None
AttributeError: 'NoneType' object has no attribute 'get_document'
[14:49:23  LSP Server Log] python@/home/cyan
2024-03-29 14:49:23,159 EDT - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request 3
Traceback (most recent call last):
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 117, in consume
    self._handle_request(message['id'], message['method'], message.get('params'))
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 197, in _handle_request
    handler_result = handler(params)
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
    return method(**(params or {}))
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 362, in m_text_document__document_symbol
    return self.document_symbols(textDocument['uri'])
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 275, in document_symbols
    return flatten(self._hook('pylsp_document_symbols', doc_uri))
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 154, in _hook
    doc = workspace.get_document(doc_uri) if doc_uri else None
AttributeError: 'NoneType' object has no attribute 'get_document'
[14:49:23  LSP Server Log] python@/home/cyan
2024-03-29 14:49:23,175 EDT - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request 4
Traceback (most recent call last):
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 117, in consume
    self._handle_request(message['id'], message['method'], message.get('params'))
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 197, in _handle_request
    handler_result = handler(params)
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
    return method(**(params or {}))
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 362, in m_text_document__document_symbol
    return self.document_symbols(textDocument['uri'])
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 275, in document_symbols
    return flatten(self._hook('pylsp_document_symbols', doc_uri))
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 154, in _hook
    doc = workspace.get_document(doc_uri) if doc_uri else None
AttributeError: 'NoneType' object has no attribute 'get_document'
[14:49:23  LSP Server Log] python@/home/cyan
2024-03-29 14:49:23,186 EDT - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request 5
Traceback (most recent call last):
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 117, in consume
    self._handle_request(message['id'], message['method'], message.get('params'))
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 197, in _handle_request
    handler_result = handler(params)
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
    return method(**(params or {}))
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 362, in m_text_document__document_symbol
    return self.document_symbols(textDocument['uri'])
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 275, in document_symbols
    return flatten(self._hook('pylsp_document_symbols', doc_uri))
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 154, in _hook
    doc = workspace.get_document(doc_uri) if doc_uri else None
AttributeError: 'NoneType' object has no attribute 'get_document'
[14:49:23  LSP Server Log] python@/home/cyan
2024-03-29 14:49:23,194 EDT - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request 6
Traceback (most recent call last):
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 117, in consume
    self._handle_request(message['id'], message['method'], message.get('params'))
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 197, in _handle_request
    handler_result = handler(params)
  File "/home/cyan/.local/lib/python3.10/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
    return method(**(params or {}))
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 362, in m_text_document__document_symbol
    return self.document_symbols(textDocument['uri'])
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 275, in document_symbols
    return flatten(self._hook('pylsp_document_symbols', doc_uri))
  File "/usr/lib/python3/dist-packages/pylsp/python_lsp.py", line 154, in _hook
    doc = workspace.get_document(doc_uri) if doc_uri else None
AttributeError: 'NoneType' object has no attribute 'get_document'
@fgpietersz
Copy link

I had the same problem with Kate, and think it is Kate specific.

I found downgraging to python-lsp-server 1.10 fixed it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants