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

3
  • are you using some custom shell like zsh ? Commented Nov 6, 2014 at 7:39
  • @igaurav No, I use bash. I used '$' as the prompt in the first snippet, and the second block is Python. Why ? Commented Nov 6, 2014 at 8:26
  • i thought if you messed up with $pythonpath in bashrc ? or require to .. Commented Nov 6, 2014 at 11:40

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.