How to set the working or current directory in the notebook?
If I start sage in my directory ~/Sage/
then !pwd
returns that directory. If I start a notebook though, the directory, given with
import os
os.getcwd()
is a temporary directory within the /tmp
tree. And if I try to change that directory with os.chdir("/home/me/Sage")
then that change doesn't seem to "stick", in that the second time I call os.getcwd()
it gives me the /tmp
directory again.
What I want to do is to run the Sage notebook in such a way that I can load files from its current working directory. I tried starting the notebook with notebook("/home/me/Sage")
but it seems to make no difference. Unless of course the results of os
are wrong.
How can I fix the working directory for use within the notebook?