Chris
Chris

Reputation: 31206

Jupyter Notebook in Pycharm: Outside root contents

This seems to be a tenacious issue in pycharm. In my case, I have a set of project roots:

libs/     <--- content root
  | lib1/
  | lib2/
  | .../
  | libn/

apps/     <--- content root

notebooks/ <--- content root

Each has been flagged as a "sources" folder in the content roots dialog as part of this debugging process.

When I open a .ipynb inside notebooks/, and run, say:

import os

The result is the following error message:

Run Error
.../path-to-ipynb/foo.ipynb is outside root contents directory

This is the new pycharm 2020.2..., fully updated.

How does one get around this?

Upvotes: 1

Views: 1595

Answers (1)

ScarletPumpernickel
ScarletPumpernickel

Reputation: 678

I had the same issue, worked around by setting c.ContentsManager.root_dir = 'c:/path_to_notebook_dir' in my jupyter_notebook_config.py to point to the directory containing the notebook.

Upvotes: 1

Related Questions