`%cd` magic does not work
gaow opened this issue · 7 comments
gaow commented
BoPeng commented
%cd
does not change the current directory of a running kernel so it needs to be executed before the kernel is started.
I could not find a way to change current directory of a running process.
BoPeng commented
But when I think of this problem now, I think we can define a command for each kernel and execute it silently to change directory with the %cd
magic.
gaow commented
BoPeng commented
No. If you start a subkernel before you use %cd
, %cd
does not apply to the subkernel.
This should be the same for JLab and Jupyter Notebook.
BoPeng commented
sos
:os.chdir(os.path.expanduser(to_dir))
python2
/python3
: the sameR
:setwd(dir)
matlab
:cd dir
node
/javascript
:process.chdir('/tmp');
bash
:cd dir
SAS
:x 'cd <full path>';
(according to here)julia
:cd("/")
A potential problem is that dir
might be given in a format that is not acceptable to some of the kernels.
BoPeng commented
BoPeng commented