Skip to content

Running a file will not correctly escape the filename #25508

@codesensei-courses

Description

@codesensei-courses

Type: Bug

Behaviour

The python extension does not properly escape filenames when passing them as arguments to the python interpreter when you run them. This fails when you use quotes in a filename.

I understand that modules should not have quotes in the name, but there seems to be no such limitation on filenames passed to the python interpreter, so in my opinion this is a bug in the extension. In any case validating the module name should be up to Python, not the extension.

I saw this behaviour both on Mac OS and Windows+WSL.

Steps to reproduce:

Create a filename with quotes in it, e.g. "test".py

Run it using the Python extension.

This will fail:

python: can't open file '/Users/reindert/demo/test.py': [Errno 2] No such file or directory

Extension version: 2025.14.0
VS Code version: Code 1.104.3 (Universal) (385651c938df8a906869babee516bffd0ddb9829, 2025-10-02T12:30:51.747Z)
OS version: Darwin arm64 24.3.0
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.6
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): PipEnv
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
ansible red 25.9.0
copilot Git 1.372.0
copilot-chat Git 0.31.4
debugpy ms- 2025.10.0
js-debug ms- 1.104.0
js-debug-companion ms- 1.1.3
jupyter ms- 2025.8.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.3.0
mypy-type-checker ms- 2025.2.0
python ms- 2025.14.0
ruff cha 2025.26.0
vscode-containers ms- 2.2.0
vscode-js-profile-table ms- 1.0.10
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
vscode-pylance ms- 2025.8.3
vscode-python-envs ms- 1.8.0
vscode-yaml red 1.19.0
System Info
Item Value
CPUs Apple M4 (10 x 2400)
GPU Status 2d_canvas: enabled
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 3, 2, 2
Memory (System) 16.00GB (0.06GB free)
Process Argv --crash-reporter-id 92110737-0b4d-4d75-9862-eb1d81e07ab5
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vswsl492:30256859
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
usemplatestapi:31297334
6518g693:31334701
aj953862:31281341
cs4_fixed:31391938
nes-set-on:31351930
testaa123:31335226
6abeh943:31336334
aa_c:31379599
0cj2b977:31352657
gendocstringt:31395207
0574c672:31362109
cloudbuttont:31379625
todos-0:31390406
multireplacestring:31393295
treatment_gpt5applypatchexclusively:31394181
3efgi100_wstrepl:31382709
trigger-command-fix:31379601
auto_model_enabled:31385282
use-responses-api:31390855
bd6f95_c:31397101

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-neededNeeds assignment to the proper sub-team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions