Skip to content

set python.terminal.executeInFileDir not working, python file run earlier than cd command #835

Closed

Description

@kaala

Behaviour

I expect set python.terminal.executeInFileDir=true will let run python file command run under the file dir, but the terminal is first execute the python file, then change to file dir.
the button is not working on the first run.

PS, report bug is also not working.
report bug jump to a instruction page, instruct to create bug from vscode.
but from vscode, click preview button jump to issue template select dialog.
loop forever.

Steps to reproduce:

  1. close all running terminal
  2. create a folder, and add a py file
  3. print(os.getcwd())
  4. click run python file button
  5. the terminal print the workspace dir, and after execute the py file, the terminal change to the file location.

Image

Diagnostic data

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

import os
print("current dir", os.getcwd())
source /workspace/runner/venv/bin/activate
root ➜ /workspace/runner (master) $ source /workspace/runner/venv/bin/activate
(venv) root ➜ /workspace/runner (master) $ /workspace/runner/venv/bin/python -B /workspace/runner/demo/r.py
cd /workspace/runner/demo
current dir /media/workspace/runner
(venv) root ➜ /workspace/runner (master) $ cd /workspace/runner/demo
(venv) root ➜ /workspace/runner/demo (master) $ 

Activity

  1. anthonykim1 commented on Sep 13, 2025

    @anthonykim1
    Contributor

    Eleanor Boyd (@eleanorjboyd) Does environment extension handle sending commands differently than python extension?

  2. removed
    bugIssue identified by VS Code Team member as probable bug
    info-neededIssue requires more information from poster
    on Sep 13, 2025
  3. added
    bugIssue identified by VS Code Team member as probable bug
    area-terminalEnvironment extension specific terminal issues.
    and removed on Dec 15, 2025
  4. anthonykim1 commented on Dec 15, 2025

    @anthonykim1
    Contributor

    Are folks still experiencing this?

  5. kaala commented on Dec 16, 2025

    @kaala
    Author

    Hi, the problem seems fixed in vscode 1.107.0.

  6. locked as resolved and limited conversation to collaborators on Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-terminalEnvironment extension specific terminal issues.bugIssue identified by VS Code Team member as probable bugconfirmation-pendingThe issue needs to be confirmed through a maintainer reproducing the bug.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions