<#17692 Running tests with --debug-adapter fails> ...
# github-notifications
q
#17692 Running tests with --debug-adapter fails Issue created by CJTurpie Describe the bug Following on from #17678 another issue emerged. After running
./pants_from_sources test --debug-adapter <path to python test file>
and connecting VS code to the debug adapter I receive the following error message:
Copy code
Traceback (most recent call last):
  File "/Users/carlturpie/.cache/pants/named_caches/pex_root/venvs/s/8e7d5b6b/venv/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 288, in __getitem__
    return next(iter(self.select(name=name)))
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/private/var/folders/vt/dcxqbnwx731dttw2b1ngmsc00000gn/T/pants-sandbox-0tW1Lu/./.cache/pex_root/venvs/4e8d5b27a5a9f5b3632585044ba3ea800870f4e4/b650ff237ac9fb4381cecc1688ad035a2365dc36/pex", line 248, in <module>
    runpy.run_module(module_name, run_name="__main__", alter_sys=True)
  File "/Users/carlturpie/.pyenv/versions/3.9.15/lib/python3.9/runpy.py", line 225, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/Users/carlturpie/.pyenv/versions/3.9.15/lib/python3.9/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/Users/carlturpie/.pyenv/versions/3.9.15/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/carlturpie/.cache/pants/named_caches/pex_root/venvs/s/8e7d5b6b/venv/lib/python3.9/site-packages/debugpy/__main__.py", line 45, in <module>
    cli.main()
  File "/Users/carlturpie/.cache/pants/named_caches/pex_root/venvs/s/8e7d5b6b/venv/lib/python3.9/site-packages/debugpy/server/cli.py", line 444, in main
    run()
  File "/Users/carlturpie/.cache/pants/named_caches/pex_root/venvs/s/8e7d5b6b/venv/lib/python3.9/site-packages/debugpy/server/cli.py", line 344, in run_code
    eval(code, {})
  File "<string>", line 1, in <module>
  File "/Users/carlturpie/.cache/pants/named_caches/pex_root/venvs/s/8e7d5b6b/venv/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 290, in __getitem__
    raise KeyError(name)
KeyError: 'console_scripts'
My launch.json in VSCode is as follows:
Copy code
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: Remote Attach",
      "type": "python",
      "request": "attach",
      "connect": {
        "host": "localhost",
        "port": 5678
      },
      "pathMappings": [
        {
          "localRoot": "${workspaceFolder}",
          "remoteRoot": "."
        }
      ],
      "justMyCode": true
    }
  ]
}
Pants version The version in #17678 OS MacOS - Arm Additional info I've sent the generated pex to @thejcannon on slack (and attached here pex.zip) pantsbuild/pants
u