2

I would like to change the path for every notebook that is loaded for an IPython profile. I have the following directory structure on Mac OS X:

/Users/user/project
├── main.py
├── reqs
├── notebooks
├── profile
└── ve, requirements.txt...

On this profile, I want to show the user the notebooks that are in the notebook folder, add this root folder to the path, and preload the main and reqs modules there.

I created a profile folder, and I run IPython like so:

$ ./ve/bin/ipython notebook --profile-dir=`pwd`/profile

I added the following to the file profile/startup/00-setup.py

c = get_config()

import os, sys

# Modify the path to include the core files
cur_folder = os.path.dirname(os.path.realpath(__file__))
sys.path.append('{}/../..'.format(cur_folder))

# Preload some modules
from main import *
from reqs import *

But somehow this doesn't have any effects, and I don't see any errors when it launches.

I found the question Change IPython working directory to be relevant, but in my case the path I want to add is different than the notebooks folder.

Thanks

Community
  • 1
  • 1
user1496984
  • 10,957
  • 8
  • 37
  • 46

0 Answers0