Skip to content

File paths containing spaces return errors when run #2053

Backlog

Description

@lukelaurence

Running a script through VS Code's "run" button returns a "[Errno 2] No such file or directory" if the filename contains a space. It seems to be doubling the path, returning an erroneous filepath. Disabling the Python Environments extension, which I have never utilized, fixed the issue.

E.g.,

/Library/Frameworks/Python.framework/Versions/3.13/Resources/Python.app/Contents/MacOS/Python: can't open file '/Users/name/Documents/Code/Two Words/Three More Words/"/Users/lukelaurence/Documents/Code/Two Words/Three More Words/test.py"': [Errno 2] No such file or directory

Environment data

  • Python Environments extension version: 1.44.0
  • Python extension (ms-python.python) version: 2026.10.0
  • VS Code version (Help → About): 1.147.0 (Universal)
    Commit: 8a14f0cc1b08d531eb83255ea3764ae22aa932b5
    Electron: 43.8.9
    ElectronBuildId: 16012121
    Chromium: 150.0.7871.250
    Node.js: 24.22.1
    V8: 15.0.245.31-electron.0
    OS: Darwin arm64 27.0.1
  • OS and version: MacOs Golden Gate
  • Python version (& distribution if applicable, e.g. Anaconda): 3.13.3
  • Environment manager in use (venv / conda / pyenv / poetry / pipenv / system / uv / other): none
  • Shell (bash / zsh / fish / pwsh / cmd / other): zsh
  • Remote / container scenario (none / WSL / SSH Remote / Dev Container / Codespaces): none
  • Workspace type (single folder / multi-root / mono-repo): single folder
  • Is this a regression? If yes, last known working extension version: no

Repro Steps

  1. Run a program with a space in the file path

Expected behavior: It works

Actual behavior: File not found due to mangled file path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions