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

debugpy: "python" key is required in "launch" request #29

Closed
puremourning opened this issue Jan 31, 2020 · 1 comment
Closed

debugpy: "python" key is required in "launch" request #29

puremourning opened this issue Jan 31, 2020 · 1 comment

Comments

@puremourning
Copy link

Environment data

  • PTVSD version:
(debugpy) BenMBP:vimspector ben$ python -m debugpy --version
1.0.0b1
  • OS and version: macOS Catalina
  • Python version (& distribution if applicable, e.g. Anaconda):
(debugpy) BenMBP:vimspector ben$ python --version
Python 3.7.6
  • Using VS Code or Visual Studio: vimspector

Actual behavior

When launching the debugee, the following exception is raised, when the launch configuration does not specify "python" key;

E+00000.028: /handling microsoft/ptvsd#1 request "launch" from Adapter/
             Traceback (most recent call last):
               File "/Users/ben/.pyenv/versions/debugpy/lib/python3.7/site-packages/debugpy/l
auncher/../../debugpy/common/messaging.py", line 413, in __call__
                 value = validate(value)
               File "/Users/ben/.pyenv/versions/debugpy/lib/python3.7/site-packages/debugpy/l
auncher/../../debugpy/common/json.py", line 222, in validate
                 raise ValueError(size_err)
             ValueError: must have at least 1 elements
             
             During handling of the above exception, another exception occurred:
             
             Traceback (most recent call last):
               File "/Users/ben/.pyenv/versions/debugpy/lib/python3.7/site-packages/debugpy/l
auncher/../../debugpy/common/messaging.py", line 1060, in __init__
                 raise self
             debugpy.common.messaging.InvalidMessageError: Invalid message: "python" must hav
e at least 1 elements
             
             Stack where logged:
               File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/
lib/python3.7/threading.py", line 890, in _bootstrap
                 self._bootstrap_inner()
               File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/
lib/python3.7/threading.py", line 926, in _bootstrap_inner
                 self.run()
               File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/
lib/python3.7/threading.py", line 870, in run
                 self._target(*self._args, **self._kwargs)
               File "/Users/ben/.pyenv/versions/debugpy/lib/python3.7/site-packages/debugpy/l
auncher/../../debugpy/common/messaging.py", line 1502, in _run_handlers
                 handler()
               File "/Users/ben/.pyenv/versions/debugpy/lib/python3.7/site-packages/debugpy/l
auncher/../../debugpy/common/messaging.py", line 745, in _handle
                 result = handler(self)
               File "/Users/ben/.pyenv/versions/debugpy/lib/python3.7/site-packages/debugpy/l
auncher/../../debugpy/launcher/handlers.py", line 58, in launch_request
                 python = request(python_key, json.array(unicode, vectorize=True, size=(1,)))
               File "/Users/ben/.pyenv/versions/debugpy/lib/python3.7/site-packages/debugpy/l
auncher/../../debugpy/common/messaging.py", line 503, in __call__
                 return self.payload(*args, **kwargs)
               File "/Users/ben/.pyenv/versions/debugpy/lib/python3.7/site-packages/debugpy/l
auncher/../../debugpy/common/messaging.py", line 419, in __call__
                 raise message.isnt_valid("{0!j}{1}", key, err)
               File "/Users/ben/.pyenv/versions/debugpy/lib/python3.7/site-packages/debugpy/l
auncher/../../debugpy/common/messaging.py", line 553, in isnt_valid
                 return self.error(InvalidMessageError, *args, **kwargs)
               File "/Users/ben/.pyenv/versions/debugpy/lib/python3.7/site-packages/debugpy/l
auncher/../../debugpy/common/messaging.py", line 544, in error
                 exc = exc_type(reason, self, silent)  # will log it
               File "/Users/ben/.pyenv/versions/debugpy/lib/python3.7/site-packages/debugpy/l
auncher/../../debugpy/common/messaging.py", line 1062, in __init__
                 log.exception()
             

E+00000.040: /handling microsoft/ptvsd#1 request "launch" from Adapter/
             Handler 'launch_request' (file '/Users/ben/.pyenv/versions/debugpy/lib/python3.7
/site-packages/debugpy/launcher/../../debugpy/launcher/handlers.py', line 17)
             couldn't handle microsoft/ptvsd#1 request "launch" from Adapter:
             Invalid message: "python" must have at least 1 elements

Here's the protocol log (vimspector <-> debugpy.adapter):

2020-01-31 23:04:22,378 - INFO - Starting debug adapter with: {"command": ["python", "-m", "debugpy.adapter"], "name": "debugpy"}
2020-01-31 23:04:22,384 - INFO - Debug Adapter Started
2020-01-31 23:04:22,385 - DEBUG - Sending Message: {"command": "initialize", "arguments": {"adapterID": "debugpy", "clientID": "vimspector", "clientName": "vimspector", "linesStartAt1": true, "columnsStartAt1": true, "locale": "en_GB", "pathFormat": "path", "supportsVariableType": true, "supportsVariablePaging": false, "supportsRunInTerminalRequest": true}, "seq": 0, "type": "request"}
2020-01-31 23:04:22,522 - DEBUG - Message received: {'seq': 1, 'type': 'event', 'event': 'output', 'body': {'category': 'telemetry', 'output': 'ptvsd', 'data': {'packageVersion': '1.0.0b1'}}}
2020-01-31 23:04:22,525 - DEBUG - Message received: {'seq': 2, 'type': 'event', 'event': 'output', 'body': {'category': 'telemetry', 'output': 'debugpy', 'data': {'packageVersion': '1.0.0b1'}}}
2020-01-31 23:04:22,527 - DEBUG - Message received: {'seq': 3, 'type': 'response', 'request_seq': 0, 'success': True, 'command': 'initialize', 'body': {'supportsCompletionsRequest': True, 'supportsConditionalBreakpoints': True, 'supportsConfigurationDoneRequest': True, 'supportsDebuggerProperties': True, 'supportsDelayedStackTraceLoading': True, 'supportsEvaluateForHovers': True, 'supportsExceptionInfoRequest': True, 'supportsExceptionOptions': True, 'supportsHitConditionalBreakpoints': True, 'supportsLogPoints': True, 'supportsModulesRequest': True, 'supportsSetExpression': True, 'supportsSetVariable': True, 'supportsValueFormattingOptions': True, 'supportsTerminateDebuggee': True, 'supportsGotoTargetsRequest': True, 'exceptionBreakpointFilters': [{'filter': 'raised', 'label': 'Raised Exceptions', 'default': False}, {'filter': 'uncaught', 'label': 'Uncaught Exceptions', 'default': True}]}}
2020-01-31 23:04:22,527 - DEBUG - Sending Message: {"command": "launch", "arguments": {"request": "launch", "type": "python", "cwd": "/Users/ben/.vim/bundle/vimspector/support/test/python/simple_python", "program": "/Users/ben/.vim/bundle/vimspector/support/test/python/simple_python/main.py", "stopOnEntry": true, "console": "integratedTerminal", "name": "test"}, "seq": 1, "type": "request"}
2020-01-31 23:04:22,528 - DEBUG - Message received: {'seq': 4, 'type': 'request', 'command': 'runInTerminal', 'arguments': {'kind': 'integrated', 'title': 'Python Debug Console', 'args': ['/Users/ben/.pyenv/versions/debugpy/bin/python', '/Users/ben/.pyenv/versions/debugpy/lib/python3.7/site-packages/debugpy/launcher', '/Users/ben/.vim/bundle/vimspector/support/test/python/simple_python/main.py'], 'env': {'DEBUGPY_LAUNCHER_PORT': '55951'}}}
2020-01-31 23:04:22,534 - DEBUG - Sending Message: {"seq": 2, "type": "response", "request_seq": 4, "command": "runInTerminal", "body": {"processId": 44305}, "success": true}
2020-01-31 23:04:22,534 - DEBUG - Calling: vimspector#internal#job#Send(g:vimspector_internal_arg_0)
2020-01-31 23:04:22,618 - INFO - Server stderr: E+00000.124: /handling microsoft/ptvsd#1 request "launch" from IDE[1]/
             Handler 'IDE._start_message_handler.<locals>.handle' (file '/Users/ben/.pyenv/versions/debugpy/lib/python3.7/site-packages/debugpy/adapter/components.py', line 170)
             couldn't handle microsoft/ptvsd#1 request "launch" from IDE[1]:
             Invalid message: "python" must have at least 1 elements


2020-01-31 23:04:22,626 - DEBUG - Message received: {'seq': 5, 'type': 'response', 'request_seq': 1, 'success': False, 'command': 'launch', 'message': 'Invalid message: "python" must have at least 1 elements'}

Expected behavior

Debugee starts, adapter connects. Launcher uses the sys.executable used to start the debug debugpy.adapter (per comment: microsoft/ptvsd#2068 (comment))

Steps to reproduce:

  1. Send a launch request, but don't specify "python" in the request configuration
@int19h int19h transferred this issue from microsoft/ptvsd Jan 31, 2020
@int19h int19h closed this as completed in 14e35ee Jan 31, 2020
@puremourning
Copy link
Author

wow, thanks for the quick fix :)

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

1 participant