anaconda / nb_conda_kernels

Package for managing conda environment-based kernels inside of Jupyter
BSD 3-Clause "New" or "Revised" License
601 stars 70 forks source link

python current working directory set to default when changing kernel #226

Closed Bjarkehingrumme closed 8 months ago

Bjarkehingrumme commented 1 year ago

When launching Jupyter lab from an anaconda prompt and navigating to a notebook residing in e.g. 'DIRPATH', running a cell import os os.getcwd() outputs 'DIRPATH'

After switching the kernel (using the menu) to some other kernel import os os.getcwd() outputs a default directory (in my case 'C:\Users\%USERNAME%')

Switching back to the kernel that launched the Jupyter lab instance restores 'DIRPATH' as the current working directory

Is this the intended behavior? It makes it hard to use relative paths to e.g. data files in a project.

mcg1969 commented 8 months ago

I'm unable to reproduce this with JupyterLab 4.1.2. Specifically, I can:

mcg1969 commented 8 months ago

I'm going to close this as stale but if you would like to re-open with some testing instructions please do!