You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
python.terminal.executeInFileDir doesn't work if file is on another drive from working directory #14730
Extension version (available under the Extensions sidebar): 2020.11.358366026
OS and version: Windows 10.0.19042
Python version (& distribution if applicable, e.g. Anaconda): Anaconda Python 3.6.12 64-bit
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
Relevant/affected Python packages and their versions: NA
Relevant/affected Python-related VS Code extensions and their versions: NA
Value of the python.languageServer setting: Pylance
Expected behaviour
Expect that if the file directory is on a different drive to the working directory and "python.terminal.executeInFileDir" is set to true, that the terminal will change drive, then change directory, then run python file
Actual behaviour
Terminal opens, changes directory and then runs python file
Steps to reproduce:
Have python.terminal.executeInFileDir = True
Open python file on drive other than working directory
Run python file in terminal
Terminal will open, run the 'cd FileDir' command but not change drive, and then run the python file
. Identify if it's in a different drive and then figure out what command to send accordingly. For eg. if workspace folder is currently on c: drive, and file to run is on d:. Send d: to terminal to switch the drive first. (details)
I see an issue here, running a file in a different drive works. but then when you run a file in the same dir as the workspace, it does not work. It does not restore the directory.
After step 5 of verification, run a python file from the workspace. it sends a cd but not a drive change.
Activity
karthiknadig commentedon Nov 16, 2020
peachthief (@peachthiefmedia) Thanks for identifying the issue. Yes, this is a problem if the file you are tying to use is on a different drive.
karrtikr commentedon Oct 22, 2021
The issue is here:
vscode-python/src/client/terminals/codeExecution/terminalCodeExecution.ts
Line 94 in 94a6ba8
c:drive, and file to run is ond:. Sendd:to terminal to switch the drive first. (details)afikrim commentedon Oct 28, 2021
I'd like to start solving this issue
karthiknadig commentedon Dec 1, 2021
Verification steps:
Extension should switch to the drive where the file exists, and then to the directory where the file exists, and finally execute the file.
karthiknadig commentedon Dec 1, 2021
I see an issue here, running a file in a different drive works. but then when you run a file in the same dir as the workspace, it does not work. It does not restore the directory.
After step 5 of verification, run a python file from the workspace. it sends a
cdbut not a drive change.