Skip to content

Cannot debug poetry error: TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType #987

Closed
@John15321

Description

@John15321

Issue Type: Bug

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: Version: 1.69.1
  • OS Version: macOS 12.4 21F79 arm64

Steps to Reproduce:

  1. Install poetry https://python-poetry.org/docs/
  2. Clone the poetry repository
  3. Create a poetry shell by running poetry shell this will create a poetry managed venv (the same issue happens with a normal venv)
  4. Install poetry locally poetry install
  5. Create a debug configuration like this:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "poetry help",
            "type": "python",
            "request": "launch",
            "module": "poetry",
            "args": [
                "-vvv",
                "--help"
            ],
        },
}
  1. Run the configuration
  2. This is the error Im getting (I also tried it in a debian docker container):
$  cd /Users/john/Documents/Programming/poetry ; /usr/bin/env /Users/john/Library/Caches/pypoetry/virtualenvs/poetry-WR0MsEPb-py3.9/bin/python /Users/john/.vscode/extensions/ms-python.python-2022.10.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 56594 -- -m poetry -vvv --help
Traceback (most recent call last):
  File "/Users/john/.vscode/extensions/ms-python.python-2022.10.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 252, in _on_run
    self.process_net_command_json(self.py_db, json_contents)
  File "/Users/john/.vscode/extensions/ms-python.python-2022.10.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py", line 193, in process_net_command_json
    cmd = on_request(py_db, request)
  File "/Users/john/.vscode/extensions/ms-python.python-2022.10.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py", line 501, in on_launch_request
    return self._handle_launch_or_attach_request(py_db, request, start_reason='launch')
  File "/Users/john/.vscode/extensions/ms-python.python-2022.10.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py", line 493, in _handle_launch_or_attach_request
    self._set_debug_options(py_db, request.arguments.kwargs, start_reason=start_reason)
  File "/Users/john/.vscode/extensions/ms-python.python-2022.10.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py", line 443, in _set_debug_options
    if os.path.isdir(f):
  File "/Users/john/.pyenv/versions/3.9.11/lib/python3.9/genericpath.py", line 42, in isdir
    st = os.stat(s)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType 

For some reason Pycharm runs an equivalent configuration without a problem:

pyzcarm

Extension version: 2022.10.0
VS Code version: Code 1.69.1 (b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a, 2022-07-12T08:22:10.822Z)
OS version: Darwin arm64 21.5.0
Restricted Mode: No

System Info
Item Value
CPUs Apple M1 Max (10 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 4, 3, 3
Memory (System) 32.00GB (0.09GB free)
Process Argv --crash-reporter-id 489ac4b7-c1cf-4078-8c18-4b5a4d3d1da5
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411cf:30525689
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vscscmwlcmt:30465135
cppdebug:30492333
vsclangdc:30486549

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions