Mac下VSCode Python调试因isort错误终止问题求助
环境信息
- Mac OS 11.6
- Python 3.9
- Visual Studio Code 1.73.1
问题现象
此前成功启动调试会话30余次,突然无法启动调试,提示:"isort服务在5分钟内崩溃3次,将不再重启"
已尝试的解决方案
- 关闭isort扩展:左上角进度条仅动半秒后消失,终端无命令输出
- 删除isort扩展
- 替换为其他开发者的isort扩展
- 按微软文档替换为更可靠的Python扩展版本
- 卸载并重新下载VSCode
彻底卸载VSCode的操作
将应用移至废纸篓并清空,执行以下命令删除相关文件:
rm -fr ~/Library/Preferences/com.microsoft.VSCode.helper.plist rm -fr ~/Library/Preferences/com.microsoft.VSCode.plist rm -fr ~/Library/Caches/com.microsoft.VSCode rm -fr ~/Library/Caches/com.microsoft.VSCode.ShipIt/ rm -fr ~/Library/Application\ Support/Code/ rm -fr ~/Library/Saved\ Application\ State/com.microsoft.VSCode.savedState/ rm -fr ~/.vscode/
重新安装后,调试仍无法启动,依旧显示isort服务崩溃提示,疑问:如何清除该标志让服务重新尝试启动?
疑问与推测
推测VSCode调试功能因非VSCode组件的自动更新被破坏,请问是否有人遇到过该问题?是否可通过安装其他版本组件解决?
相关日志信息
1-Python.log 末尾内容
/usr/lib/python2.7 ~/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/interpreterInfo.py
[ERROR 2022-11-2 10:16:36.608]: [Error: Command failed: /usr/lib/python2.7 /Users/ken/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/get_output_via_markers.py /Users/ken/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/interpreterInfo.py
/bin/sh: /usr/lib/python2.7: is a directory
at ChildProcess.exithandler (node:child_process:408:12) at ChildProcess.emit (node:events:526:28) at maybeClose (node:internal/child_process:1092:16) at ChildProcess._handle.onexit (node:internal/child_process:302:5)] { killed: false, code: 126, signal: null, cmd: '/usr/lib/python2.7 /Users/ken/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/get_output_via_markers.py /Users/ken/.vscode/extensions/ms-python.python-2022.19.13251009/pythonFiles/interpreterInfo.py' } Starting Pylance language server.
4-isort.log 末尾内容(重复出现多次)
Traceback (most recent call last): File "/Users/ken/.vscode/extensions/ms-python.isort-2022.8.0/bundled/tool/server.py", line 744, in LSP_SERVER.start_io() File "/Users/ken/.vscode/extensions/ms-python.isort-2022.8.0/bundled/libs/pygls/server.py", line 226, in start_io self.loop.run_until_complete( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/Users/ken/.vscode/extensions/ms-python.isort-2022.8.0/bundled/libs/pygls/server.py", line 57, in aio_readline header = await loop.run_in_executor(executor, rfile.readline) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 814, in run_in_executor executor.submit(func, *args), loop=self) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/thread.py", line 170, in submit self._adjust_thread_count() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/thread.py", line 193, in _adjust_thread_count t.start() TypeError: start() missing 1 required positional argument: 'sessionID' Error in atexit._run_exitfuncs: TypeError: stop_all_processes() missing 1 required positional argument: 'self' [Error - 10:10:30 AM] Connection to server got closed. Server will not be restarted.
内容的提问来源于stack exchange,提问作者Joymaker

