Issue
I'd like to be able to use %cd "default_dir"
and %matplotlib
whenever I call ipython
from my terminal. I tried writing this in a .py file in .ipython/profile_default/startup/file.py
but it results in the following error:
[TerminalIPythonApp] WARNING | Unknown error in handling startup files:
File "/Users/<name>/Dropbox/.ipython/profile_default/startup/startup.py", line 18
%cd "~/Dropbox/"
^
SyntaxError: invalid syntax
Solution
You just need to use the magic in your startup scripts:
get_ipython().magic('cd ~/Dropbox')
get_ipython().magic('matplotlib')
Put that in the contents of your startup script and it should do the magic you need ✨🔮✨
Answered By - Wayne Werner
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.