Skip to content

python.terminal.executeInFileDir doesn't seem to have any effect #1062

@jkyeung

Description

@jkyeung

Environment 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:

  1. Open a Python source file.
  2. Use the command palette to issue Python: Run Python File in Terminal.

Logs

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

I don't understand those instructions. If I do ViewOutput, 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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions