Yves ROBERT
Yves ROBERT

Reputation: 25

Jupyter Notebooks in VS Code No Longer Recognize Working Directory—Why?

Starting this week, my Jupyter notebooks in VS Code have stopped recognizing the working directory correctly. Previously, everything worked as expected without any manual configuration.

When I run a Python script in a new interactive window or initiate a new Jupyter notebook and execute pwd, it outputs my home directory instead of the script's directory. This behavior disrupts my ability to import other modules located in the same directory. I haven't made any recent changes to my setup that could have triggered this issue (maybe background updates?).

As a temporary workaround, I manually change the current working directory in my scripts, but this approach is inconvenient. I'm looking for a solution that rather identifies/fixes that issue.

Has anyone else experienced this issue recently? Could there be a problem with the latest versions of VS Code or its Python/Jupyter extensions? Does anyone have a solution that doesn't involve modifying every script to manually set the working directory? Thank you for your assistance!

Upvotes: 0

Views: 159

Answers (0)

Related Questions