Jupyter notebook file directory not in working directory
The problem has been posted here, but I am not sure if it has been solved yet, and what the solution is:
The problem with PyCharm is it does not add the folder in which the notebook belongs to to the working directory. PyCharm only adds the project root.
Example:
Pycharm opens D:\myproject
Jupyter notebook is located at D:\myproject\notes\note1.ipynb
When running note1.ipynb,
In Pycharm, print(sys.path) >> D:\myproject
In localhost:8888, print(sys.path) >> D:\myproject\notes
I can manually add path for every notebook file, but it is incredibly annoying. I want PyCharm to automatically add X:\the\directory\of\the\notebook\ to PATH, like how jupyter server does.
I am using 2020.2 Professional, if that matters. Thanks for the help.
Please sign in to leave a comment.