#python #python-3.x #visual-studio-code
#python #python-3.x #visual-studio-code
Вопрос:
Я пытаюсь запустить свой отладчик python в vscode, он запускается, но выдает огромное количество выходных данных, и я не уверен, почему. Эта простая программа:
print('hello world!')
Создает этот вывод в терминале:
amp; 'C:UsersuserAnaconda3envstrader2python.exe' 'c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpylauncher' '56764' '--' 'test'
Using GEVENT_SUPPORT: False
pydevd __file__: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy_vendoredpydevdpydevd.py
pydevd: Use libraries filter: False
IDE_PROJECT_ROOTS []
Collecting default library roots.
LIBRARY_ROOTS ['C:\Users\user\Anaconda3\envs\trader2', 'C:\Users\user\Anaconda3\envs\trader2\Lib', 'C:\Users\user\Anaconda3\envs\trader2\Lib\site-packages', 'C:\Users\user\Anaconda3\envs\trader2\lib', 'C:\Users\user\Anaconda3\envs\trader2\lib\site-packages', 'C:\Users\user\AppData\Roaming\Python\Python38\site-packages']
Connecting to 127.0.0.1:56763
Connected.
Process PydevdAuthorizeRequest: {
"arguments": {},
"command": "pydevdAuthorize",
"seq": 1,
"type": "request"
}
sending cmd --> CMD_RETURN {"type": "response", "request_seq": 1, "success": true, "command": "pydevdAuthorize", "body": {"clientAccessToken": "01613d0f058317954171a32f34b5822ea3741cf3eec19ff1469796e32afa3f03"}, "seq": 2, "pydevd_cmd_id": 502}
Process PydevdSystemInfoRequest: {
"arguments": {},
"command": "pydevdSystemInfo",
"seq": 2,
"type": "request"
}
sending cmd --> CMD_RETURN {"type": "response", "request_seq": 2, "success": true, "command": "pydevdSystemInfo", "body": {"python": {"version": "3.8.5final0", "implementation": {"name": "cpython", "version": "3.8.5final0", "description": "CPython"}}, "platform": {"name": "win32"}, "process": {"pid": 221700, "ppid": 221604, "executable": "C:\Users\user\Anaconda3\envs\trader2\python.exe", "bitness": 64}, "pydevd": {"usingCython": false, "usingFrameEval": false}}, "seq": 4, "pydevd_cmd_id": 502}
Process EvaluateRequest: {
"arguments": {
"expression": "nif 'debugpy' not in sys.modules:n sys.path.insert(0, 'c:\\Users\\user\\.vscode\\extensions\\ms-python.python-2020.9.112786\\pythonFiles\\lib\\python')n try:n import debugpyn finally:n del sys.path[0]n",
"format": {}
},
"command": "evaluate",
"seq": 3,
"type": "request"
}
processing internal command: InternalThreadCommands(<function internal_evaluate_expression_json at 0x00000197CD0B0160>, (<_pydevd_bundle._debug_adapter.pydevd_schema.EvaluateRequest object at 0x00000197CD2630A0>, '*'), {})
sending cmd --> CMD_RETURN {"type": "response", "request_seq": 3, "success": true, "command": "evaluate", "body": {"result": "", "variablesReference": 0, "presentationHint": {}}, "seq": 6, "pydevd_cmd_id": 502}
Process PydevdAuthorizeRequest: {
"arguments": {},
"command": "pydevdAuthorize",
"seq": 4,
"type": "request"
}
sending cmd --> CMD_RETURN {"type": "response", "request_seq": 4, "success": true, "command": "pydevdAuthorize", "body": {"clientAccessToken": "01613d0f058317954171a32f34b5822ea3741cf3eec19ff1469796e32afa3f03"}, "seq": 8, "pydevd_cmd_id": 502}
Process InitializeRequest: {
"arguments": {
"adapterID": "python",
"clientID": "vscode",
"clientName": "Visual Studio Code",
"columnsStartAt1": true,
"linesStartAt1": true,
"locale": "en-us",
"pathFormat": "path",
"supportsProgressReporting": true,
"supportsRunInTerminalRequest": true,
"supportsVariablePaging": true,
"supportsVariableType": true
},
"command": "initialize",
"seq": 5,
"type": "request"
}
sending cmd --> CMD_RETURN {"type": "response", "request_seq": 5, "success": true, "command": "initialize", "seq": 10, "body": {"supportsConfigurationDoneRequest": true, "supportsFunctionBreakpoints": false, "supportsConditionalBreakpoints": true, "supportsHitConditionalBreakpoints": true, "supportsEvaluateForHovers": true, "exceptionBreakpointFilters": [{"filter": "raised", "label": "Raised Exceptions", "default": false}, {"filter": "uncaught", "label": "Uncaught Exceptions", "default": true}, {"filter": "userUnhandled", "label": "User Uncaught Exceptions", "default": false}], "supportsStepBack": false, "supportsSetVariable": true, "supportsRestartFrame": false, "supportsGotoTargetsRequest": true, "supportsStepInTargetsRequest": false, "supportsCompletionsRequest": true, "completionTriggerCharacters": [], "supportsModulesRequest": true, "additionalModuleColumns": [], "supportedChecksumAlgorithms": [], "supportsRestartRequest": false, "supportsExceptionOptions": true, "supportsValueFormattingOptions": true, "supportsExceptionInfoRequest": true, "supportTerminateDebuggee": true, "supportsDelayedStackTraceLoading": true, "supportsLoadedSourcesRequest": false, "supportsLogPoints": true, "supportsTerminateThreadsRequest": false, "supportsSetExpression": true, "supportsTerminateRequest": true, "supportsDataBreakpoints": false, "supportsReadMemoryRequest": false, "supportsDisassembleRequest": false, "supportsDebuggerProperties": true, "pydevd": {"processId": 221700}}, "pydevd_cmd_id": 502}
Process LaunchRequest: {
"arguments": {
"__sessionId": "1df1314f-0b89-442d-bb61-c50d51504139",
"console": "integratedTerminal",
"cwd": "c:\code\python\python_zmq",
"debugOptions": [
"ShowReturnValue",
"FixFilePathCase"
],
"env": {
"PYTHONIOENCODING": "UTF-8",
"PYTHONUNBUFFERED": "1"
},
"envFile": "c:\code\python\python_zmq/.env",
"internalConsoleOptions": "neverOpen",
"justMyCode": true,
"name": "hello world",
"processName": "test",
"program": "test",
"pythonArgs": [],
"pythonPath": "C:\Users\user\Anaconda3\envs\trader2\python.exe",
"request": "launch",
"showReturnValue": true,
"stopOnEntry": false,
"type": "python",
"workspaceFolder": "c:\code\python\python_zmq"
},
"command": "launch",
"seq": 6,
"type": "request"
}
sending cmd --> CMD_PROCESS_EVENT {"type": "event", "event": "process", "body": {"name": "test", "systemProcessId": 221700, "isLocalProcess": true, "startMethod": "launch"}, "seq": 12, "pydevd_cmd_id": 204}
pydevd: Use libraries filter: True
Show return values: True
sending cmd --> CMD_RETURN {"type": "response", "request_seq": 6, "success": true, "command": "launch", "seq": 14, "pydevd_cmd_id": 502}
Process SetDebuggerPropertyRequest: {
"arguments": {
"ideOS": "WINDOWS",
"multiThreadsSingleNotification": true,
"skipPrintBreakpointException": [
"NameError"
],
"skipSuspendOnBreakpointException": [
"BaseException"
]
},
"command": "setDebuggerProperty",
"seq": 7,
"type": "request"
}
sending cmd --> CMD_RETURN {"type": "response", "request_seq": 7, "success": true, "command": "setDebuggerProperty", "seq": 16, "body": {}, "pydevd_cmd_id": 502}
Process SetExceptionBreakpointsRequest: {
"arguments": {
"filters": [
"uncaught"
]
},
"command": "setExceptionBreakpoints",
"seq": 8,
"type": "request"
}
Exceptions to hook on terminate: {'BaseException': <_pydevd_bundle.pydevd_breakpoints.ExceptionBreakpoint object at 0x00000197CD25A850>}.
sending cmd --> CMD_RETURN {"type": "response", "request_seq": 8, "success": true, "command": "setExceptionBreakpoints", "seq": 18, "pydevd_cmd_id": 502}
Process ConfigurationDoneRequest: {
"arguments": {},
"command": "configurationDone",
"seq": 9,
"type": "request"
}
sending cmd --> CMD_RETURN {"type": "response", "request_seq": 9, "success": true, "command": "configurationDone", "seq": 20, "pydevd_cmd_id": 502}
sending cmd --> CMD_THREAD_CREATE {"type": "event", "event": "thread", "body": {"reason": "started", "threadId": 1}, "seq": 22, "pydevd_cmd_id": 103}
File not traced (not in project - force_check_project_scope): c:usersuseranaconda3envstrader2libntpath.py
Process ThreadsRequest: {
"command": "threads",
"seq": 10,
"type": "request"
}
File not traced (not in project - force_check_project_scope): c:usersuseranaconda3envstrader2libgenericpath.py
sending cmd --> CMD_RETURN {"type": "response", "request_seq": 10, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}, "seq": 24, "pydevd_cmd_id": 502}
File not traced (not in project - force_check_project_scope): c:usersuseranaconda3envstrader2libctypes__init__.py
Successfully Loaded helper lib to set tracing to all threads.
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy_vendoredpydevdpydevd.py - set_tracing_for_untraced_contexts
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy_vendoredpydevdpydevd.py - _locked_settrace
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy_vendoredpydevdpydevd.py - settrace
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpyserverapi.py - _settrace
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpyserverapi.py - connect
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpyserverapi.py - debug
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpy__init__.py - connect
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpycommoncompat.py - kwonly_f
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpyservercli.py - start_debugging
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpyservercli.py - run_file
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpyservercli.py - main
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy__main__.py - <module>
Set tracing of frame: C:UsersuserAnaconda3envstrader2librunpy.py - _run_code
Set tracing of frame: C:UsersuserAnaconda3envstrader2librunpy.py - _run_module_as_main
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy_vendoredpydevdpydevd.py - settrace
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpyserverapi.py - _settrace
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpyserverapi.py - connect
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpyserverapi.py - debug
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpy__init__.py - connect
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpycommoncompat.py - kwonly_f
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpyservercli.py - start_debugging
Process ThreadsRequest: {
"command": "threads",
"seq": 11,
"type": "request"
}
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpyservercli.py - run_file
sending cmd --> CMD_RETURN {"type": "response", "request_seq": 11, "success": true, "command": "threads", "body": {"threads": [{"id": 1, "name": "MainThread"}]}, "seq": 26, "pydevd_cmd_id": 502}
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpyservercli.py - main
SKIP set tracing of frame: c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy__main__.py - <module>
File not traced (not in project - force_check_project_scope): c:usersuseranaconda3envstrader2libstring.py
File not traced (not in project - force_check_project_scope): c:usersuseranaconda3envstrader2libsite.py
File not traced (not in project - force_check_project_scope): c:usersuseranaconda3envstrader2libsysconfig.py
File not traced (not in project - force_check_project_scope): c:usersuseranaconda3envstrader2librunpy.py
File not traced (not in project - force_check_project_scope): c:usersuseranaconda3envstrader2libpkgutil.py
File not traced (not in project - force_check_project_scope): c:usersuseranaconda3envstrader2libos.py
Traceback (most recent call last):
File "C:UsersuserAnaconda3envstrader2librunpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:UsersuserAnaconda3envstrader2librunpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy__main__.py", line 45, in <module>
cli.main()
File "c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpyservercli.py", line 430, in main
run()
File "c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy/..debugpyservercli.py", line 267, in run_file
runpy.run_path(options.target, run_name=compat.force_str("__main__"))
File "C:UsersuserAnaconda3envstrader2librunpy.py", line 264, in run_path
code, fname = _get_code_from_file(run_name, path_name)
File "C:UsersuserAnaconda3envstrader2librunpy.py", line 234, in _get_code_from_file
with io.open_code(decoded_path) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\code\python\python_zmq\test'
sending cmd --> CMD_THREAD_KILL {"type": "event", "event": "thread", "body": {"reason": "exited", "threadId": 1}, "seq": 28, "pydevd_cmd_id": 104}
PyDB.dispose_and_kill_all_pydevd_threads (called from: File "c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy_vendoredpydevdpydevd.py", line 1581, in process_internal_commands)
No threads alive, finishing debug session
PyDB.dispose_and_kill_all_pydevd_threads (first call)
PyDB.dispose_and_kill_all_pydevd_threads no commands being processed.
PyDB.dispose_and_kill_all_pydevd_threads killing thread: <_TimeoutThread(Thread-4, started daemon 222216)>
Thread-4 received kill signal
PyDB.dispose_and_kill_all_pydevd_threads (called from: File "c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy_vendoredpydevdpydevd.py", line 238, in _on_run)
PyDB.dispose_and_kill_all_pydevd_threads killing thread: <ReaderThread(pydevd.Reader, started daemon 211432)>
PyDB.dispose_and_kill_all_pydevd_threads (already disposed - wait)
pydevd.Reader received kill signal
PyDB.dispose_and_kill_all_pydevd_threads waiting for pydb daemon threads to finish
PyDB.dispose_and_kill_all_pydevd_threads killing thread: <PyDBCommandThread(pydevd.CommandThread, started daemon 222236)>
pydevd.CommandThread received kill signal
PyDB.dispose_and_kill_all_pydevd_threads killing thread: <WriterThread(pydevd.Writer, started daemon 221352)>
sending cmd --> CMD_EXIT {"type": "event", "event": "terminated", "seq": 30, "body": {}, "pydevd_cmd_id": 129}
pydevd.Writer received kill signal
WriterThread: CMD_EXIT received
PyDB.dispose_and_kill_all_pydevd_threads killing thread: <CheckAliveThread(pydevd.CheckAliveThread, started 222248)>
ReaderThread: empty contents received (len(line) == 0).
WriterThread: exit
pydevd.CheckAliveThread received kill signal
PyDB.dispose_and_kill_all_pydevd_threads (called from: File "c:Usersuser.vscodeextensionsms-python.python-2020.9.112786pythonFileslibpythondebugpy_vendoredpydevd_pydevd_bundlepydevd_comm.py", line 305, in _terminate_on_socket_close)
PyDB.dispose_and_kill_all_pydevd_threads (already disposed - wait)
PyDB.dispose_and_kill_all_pydevd_threads: finished
PyDB.dispose_and_kill_all_pydevd_threads: finished
ReaderThread: exit
The following pydb threads may not have finished correctly: pydevd.CommandThread
PyDB.dispose_and_kill_all_pydevd_threads: finished
pydevd.stoptrace()
Что смешно, поскольку я даже не могу найти вывод на печать в этом дампе. Я попытался удалить vscode и удалить настройки, но это не сработало.
conda 4.8.5
Python 3.7.9
Windows 10 - Build 20221
Есть идеи о том, что здесь происходит?
Комментарии:
1. Похоже, что расширение VS code ‘debugpy’ может запускаться и при запуске вашей программы. Можете ли вы посмотреть, есть ли у вас это расширение, и попытаться удалить его? Также посмотрите, есть ли у вас файл launch.json с настройками вашей среды
2. вы, должно быть, включили некоторую трассировку отладки в файле настроек. Попробуйте это с пустыми файлами global и workspace (.vscode)
settings.json
или только с выбранным интерпретатором python3. @JohnS единственное расширение, которое я установил, — это «ms-python.python»
4. @rioV8 Как локальные, так и глобальные файлы settings.json пусты, результат тот же.
5. взгляните на
OUTPUT - Python
панель и посмотрите, для какого эксперимента ваш участник находится в верхней части журнала. Согласно github.com/microsoft/debugpy/issues/274#issuecomment-637745823 вы можете отказаться от экспериментов