问题描述:
from ._conv import register_converters as _register_converters
Traceback (most recent call last):
File "/home/ubuntu/.vscode/extensions/ms-python.python-2019.3.6558/pythonFiles/lib/python/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 284, in _on_run
self.process_net_command_json(self.global_debugger_holder.global_dbg, json_contents)
File "/home/ubuntu/.vscode/extensions/ms-python.python-2019.3.6558/pythonFiles/lib/python/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py", line 137, in process_net_command_json
cmd = on_request(py_db, request)
File "/home/ubuntu/.vscode/extensions/ms-python.python-2019.3.6558/pythonFiles/lib/python/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py", line 526, in on_evaluate_request
py_db, request, thread_id)
File "/home/ubuntu/.vscode/extensions/ms-python.python-2019.3.6558/pythonFiles/lib/python/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_api.py", line 385, in request_exec_or_evaluate_json
thread_id, internal_evaluate_expression_json, request, thread_id)
File "/home/ubuntu/.vscode/extensions/ms-python.python-2019.3.6558/pythonFiles/lib/python/ptvsd/_vendored/pydevd/pydevd.py", line 843, in post_method_as_internal_command
self.post_internal_command(internal_cmd, thread_id)
File "/home/ubuntu/.vscode/extensions/ms-python.python-2019.3.6558/pythonFiles/lib/python/ptvsd/_vendored/pydevd/pydevd.py", line 847, in post_internal_command
queue = self.get_internal_queue(thread_id)
File "/home/ubuntu/.vscode/extensions/ms-python.python-2019.3.6558/pythonFiles/lib/python/ptvsd/_vendored/pydevd/pydevd.py", line 834, in get_internal_queue
if thread_id.startswith('__frame__'):
AttributeError: 'NoneType' object has no attribute 'startswith'
解决方案:
主要对pydevd.py文件进行修改,路径要根据自己需要进行修改,例如我的路径: "/home/ubuntu/.vscode/extensions/ms-python.python-2019.3.6558/pythonFiles/lib/python/ptvsd/_vendored/pydevd/pydevd.py"
修改为如下所示:
global connected
connected = True # Mark that we're connected when started from inside ide.
run(debugger, setup, is_module)
def run(debugger, setup, is_module):
globals = debugger.run(setup['file'], None, None, is_module)
if setup['cmd-line']:
debugger.wait_for_commands(globals)
参考:
mac电脑调试python文件时出现错误if setup['cmd-line']: TypeError: 'NoneType' object is not callable
python安装包错误AttributeError: 'NoneType' object has no attribute 'startswith'