-
Notifications
You must be signed in to change notification settings - Fork 21
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
Message is not JSON serializable. #61
Comments
I have found the cause. This is caused by This is a dependent library of
|
Hey @Ttayu, can you also check the logs of |
@jhossbach
|
Hi, I'm the author of cattrs and came here via python-attrs/cattrs#453. It would appear the |
I managed to track it down. There's a type in Looks like there's a regression in unstructuring this type, it used to be unstructured as the runtime type, and now is unstructured as |
Great, thanks for tracking it down! |
Eh it's difficult to say since the type is weird. This is definitely being caused by a change in cattrs but I don't really know whether the current behavior or the old behavior was correct. It comes down to how cattrs handles unstructuring fields annotated as I think the old behavior might be more useful. My plan right now is to restore the old behavior in this particular case ( |
@Ttayu can you try installing cattrs from https://github.com/python-attrs/cattrs/tree/23.2 and see if it fixes the issue? If yes, I'll push it out. |
@Tinche
Thank you for your great contribution. |
23.2.2 has been released. |
Great! I will create a topic in |
Closes #301. Will resolve python-lsp/python-lsp-ruff#61
Closes microsoft#301. Will resolve python-lsp/python-lsp-ruff#61
Closes microsoft#301. Will resolve python-lsp/python-lsp-ruff#61
Closes #301. Will resolve python-lsp/python-lsp-ruff#61 Co-authored-by: Julian Hossbach <[email protected]>
I want to use
python-lsp-server
andpython-lsp-ruff
withneovim
, but I get the following error.Other plugins such as
python-lsp-black
work.LspLog
[ERROR][2023-11-19 23:17:03] .../vim/lsp/rpc.lua:734 "rpc" "/home/Ttayu/.local/share/nvim/mason/bin/pylsp" "stderr" "2023-11-19 23:17:03,317 JST - ERROR - pylsp_jsonrpc.streams - Failed to write message to output file {'jsonrpc': '2.0', 'method': 'textDocument/publishDiagnostics', 'params': {'uri': 'file:///home/Ttayu/sample.py', 'diagnostics': [{'range': {'start': {'line': 1, 'character': 7}, 'end': {'line': 1, 'character': 13}}, 'message': '
shutil
imported but unused', 'severity': 1, 'code': 'F401', 'source': 'ruff', 'tags': [1], 'data': Fix(edits=[Edit(content='', location=Location(row=2, column=1), end_location=Location(row=3, column=1))], message='Remove unused import:shutil
', applicability='safe')}, {'range': {'start': {'line': 15, 'character': 0}, 'end': {'line': 15, 'character': 14}}, 'message': 'Module level import not at top of file', 'severity': 2, 'code': 'E402', 'source': 'ruff', 'tags': []}, {'range': {'start': {'line': 15, 'character': 7}, 'end': {'line': 15, 'character': 14}}, 'message': 'pathlib
imported but unused', 'severity': 1, 'code': 'F401', 'source': 'ruff', 'tags': [1], 'data': Fix(edits=[Edit(content='', location=Location(row=16, column=1), end_location=Location(row=17, column=1))], message='Remove unused import:pathlib
', applicability='safe')}, {'source': 'mypy', 'range': {'start': {'line': 9, 'character': 15}, 'end': {'line': 9, 'character': 38}}, 'message': '"filter[Any]" has no attribute "exists"', 'severity': 1, 'code': 'attr-defined'}]}}\nTraceback (most recent call last):\n File "/home/Ttayu/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/pylsp_jsonrpc/streams.py", line 97, in write\n body = json.dumps(message, **self._json_dumps_args)\nTypeError: Fix(edits=[Edit(content='', location=Location(row=2, column=1), end_location=Location(row=3, column=1))], message='Remove unused import:shutil
', applicability='safe') is not JSON serializable\n"Environment
python-lsp-ruff: 1.6.0
ruff: 0.1.6
OS:
Linux 5.15.133.1-microsoft-standard-WSL2
5.15.0-88-generic
NeoVim: NVIM v0.9.4, v0.10.0-dev-09a17f9
pip list
/home/Ttayu/.local/share/nvim/mason/packages/python-lsp-server/venv/bin/pip list
The text was updated successfully, but these errors were encountered: