Skip to content

python.terminal.executeInFileDir no longer uses "cd" to switch the working directory #1500

@sblauth

Description

@sblauth

Type: Bug

Behaviour

With previous versions of vs code, whenever I ran a python file in a terminal, there clearly was a "cd" command running, which changed the working directory to the files' directory, when python.terminal.executeInFileDir was enabled.
Now, when I run a file and a new terminal gets launched, it correctly opens in the selected files' directory. However, when I manually cd into a different dir and try to re-run the script, the working directory is no longer changed

Steps to reproduce:

  1. Run a python file
  2. Manually switch to a different folder with cd
  3. Run the same python file again
  4. The working directory stays at the one manually switched to.

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2026-04-24 09:25:11.139 [debug] Delay Trigger[Test Configuration Change]: triggered=164, called=25
2026-04-24 09:25:13.518 [debug] Attempting to run Python file undefined
2026-04-24 09:25:17.229 [debug] Received shell integration sequence for bash
2026-04-24 09:25:17.505 [debug] Extension unknown accessed getActiveEnvironmentPath with args: undefined
2026-04-24 09:25:17.505 [debug] Extension unknown accessed resolveEnvironment with args: {"id":"/p/tv/local/miniforge/miniforge_blauths/envs/cashocs/bin/python","path":"/p/tv/local/miniforge/miniforge_blauths/envs/cashocs/bin/python"}
2026-04-24 09:25:17.899 [debug] Delay Trigger[Test Configuration Change]: triggered=169, called=26
2026-04-24 09:25:21.410 [debug] Received shell integration sequence for bash
2026-04-24 09:25:25.309 [debug] Received shell integration sequence for bash
2026-04-24 09:25:25.334 [debug] Extension unknown accessed getActiveEnvironmentPath with args: undefined
2026-04-24 09:25:25.334 [debug] Extension unknown accessed resolveEnvironment with args: {"id":"/p/tv/local/miniforge/miniforge_blauths/envs/cashocs/bin/python","path":"/p/tv/local/miniforge/miniforge_blauths/envs/cashocs/bin/python"}
2026-04-24 09:25:29.945 [debug] Received shell integration sequence for bash
2026-04-24 09:25:35.859 [debug] Received shell integration sequence for bash
2026-04-24 09:25:49.842 [debug] Received shell integration sequence for bash
2026-04-24 09:26:18.362 [debug] Attempting to run Python file undefined
2026-04-24 09:26:19.141 [debug] Delay Trigger[Test Configuration Change]: triggered=174, called=27
2026-04-24 09:26:22.736 [debug] Received shell integration sequence for bash
2026-04-24 09:26:27.494 [debug] Received shell integration sequence for bash

Extension version: 2026.4.0
VS Code version: Code 1.117.0 (10c8e557c8b9f9ed0a87f61f1c9a44bde731c409, 2026-04-21T16:12:14-07:00)
OS version: Linux x64 5.14.0-611.49.1.el9_7.x86_64
Modes:

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

Multiroot scenario, following user settings may not apply:

condaPath: "<placeholder>"

languageServer: "Pylance"

testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true
• autoTestDiscoverOnSaveEnabled: false

terminal
• executeInFileDir: "<placeholder>"

Installed Extensions
Extension Name Extension Id Version
autodocstring njp 0.6.1
copilot-chat Git 0.45.1
debugpy ms- 2025.18.0
even-better-toml tam 0.21.2
gitlab-workflow Git 6.75.1
isort ms- 2025.0.0
js-debug-companion ms- 1.1.3
jsts-chat-features Typ 0.0.2
path-intellisense chr 2.10.0
python ms- 2026.4.0
ruff cha 2026.40.0
vscode-icons vsc 12.18.0
vscode-js-profile-table ms- 1.0.10
vscode-pull-request-github Git 0.138.0
vscode-pylance ms- 2026.2.1
vscode-python-envs ms- 1.29.2026042301

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions