3

ipython notebook has setting for default working directory

c.FileNotebookManager.notebook_dir = '/path/to/my/desired/dir'

is there analogous setting for ipython console (terminal) ? I have tried adjusting following configuration parameter:

c.TerminalInteractiveShell.ipython_dir = '/path/to/my/desired/dir' 

but this seems to have no effect. There is also no comment as to what this parameter is supposed to effect.

How can I configure ipython so that my working directory upon start will be /path/to/my/desired/dir, irrespective from where I started ipython ?

1 Answer 1

6

From your home directory, go to .ipython, then your profile directory (probably profile_default), then startup. In there, create a new file with the extension .ipy, containing the lines:

import os
os.chdir('/path/to/my/desired/dir')

As pointed out by crowie in the comments, the .ipy extension also enables you to use IPython "magic" commands, so you could instead say:

%cd /path/to/my/desired/dir
Sign up to request clarification or add additional context in comments.

1 Comment

if using the .ipy extension you can also use any ipython magics or console commands eg: %cd path_to_dir

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.