python.terminal.executeInFileDir doesn't seem to have any effect
See original GitHub issueEnvironment data
- VS Code version: 1.21.0
- Extension version (available under the Extensions sidebar): 2018.2.1
- OS and version: Windows 7 Pro
- Python version: 3.6.2, 64-bit
- Type of virtual environment used (if applicable): N/A
- Relevant/affected Python packages and their versions: N/A
Actual behavior
When I issue the command Python: Run Python File in Terminal
, it always starts in the open folder, rather than in the file directory, despite the fact that I have "python.terminal.executeInFileDir": true
in my user settings.
This has been a problem since forever; this setting has never worked for me on any previous version.
Expected behavior
The terminal starts in the file directory of the Python script I’m executing.
Steps to reproduce:
- Open a Python source file.
- Use the command palette to issue
Python: Run Python File in Terminal
.
Logs
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
I don’t understand those instructions. If I do View
→Output
, there is no Python
in the drop-down. However, there is a Python
in the terminal. (If this is what you mean, then the template for the bug report should reflect that.)
Suffice it to say that within the Python script, os.getcwd()
is the open folder, when I am expecting it to be the same as sys.path[0]
instead.
Output from Console
under the Developer Tools
panel (toggle Developer Tools on under Help
)
This is empty, unless I choose Verbose.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
@brettcannon @qubitron Here’s a summary of the issue:
"python.terminal.executeInFileDir"
Python: Run Python File in Terminal
Current behavior
Proposed behavior
I’m not sure why, but we currently have tests to avoid this particular situation (possibly a test to retain the behavior inherited from old code).
✅ validated