Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kaala opened this issue Apr 30, 2025 · 4 comments
Assignees
Labels
area-terminal bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@kaala
Copy link

kaala commented Apr 30, 2025

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 (ViewOutput, 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) $ 

@kaala kaala added the feature-request Request for new features or functionality label Apr 30, 2025
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Apr 30, 2025
@karthiknadig
Copy link
Member

@kaala Can you share the logs from Output > Python?

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Apr 30, 2025
@anthonykim1 anthonykim1 added area-terminal bug Issue identified by VS Code Team member as probable bug and removed triage-needed Needs assignment to the proper sub-team feature-request Request for new features or functionality labels May 1, 2025
@kaala
Copy link
Author

kaala commented May 6, 2025

output > python log seems no useful information.
I only see send text to terminal.
Image

@anthonykim1
Copy link

Can you set your log level to trace, and reproduce the behavior to get a more verbose log?
Also which OS are you using, and which shell?

Does it help if you turn off terminal.integrated.shellIntegration.enabled setting?

@kaala
Copy link
Author

kaala commented May 13, 2025

I use remotessh to linux server, ubuntu. and the shell is bash.
I changed python log level to trace, and the output is the same, nothing new.
I wasn't set terminal.integrated.shellIntegration.enabled, but set it to false seems fixed the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-terminal bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants