Skip to content

python.dataScience.notebookFileRoot needs an option to launch with CWD = current file path #3605

@clamydo

Description

@clamydo

Environment data

  • VS Code version: 1.31
  • Extension version (available under the Extensions sidebar): 2019.1.0
  • OS and version: Debian Stretch
  • Python version (& distribution if applicable, e.g. Anaconda): 3.5.3
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: N/A

Expected behaviour

Having a Python script with cell markers #%%, I'd expect that setting python.dataScience.notebookFileRoot = ${fileDirname} makes the interactive session start in the directory the file resides.

Maybe I misunderstand that setting? At least, it is what calculateWorkingDirectory is supposed to do, isn't it?

Also see this Stack Overflow question

Actual behaviour

The interactive session starts from the workspace directory.

Steps to reproduce:

Having a structure like this

workingDir
|- foo
   |- file.py

and a file.py:

#%%
import os
print(os.getcwd())

the output in the interactive session is the absolute path of the workingDir.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions