問題:Drive側からのカレントディレクトリの削除
Google Drive と連携した Colaboratory において、現在いるディレクトリを Google Drive 側から削除すると、シェル関連のコマンドが「No such file or directory」で動かなくなってしまう。
!mkdir drive/'My Drive'/phantom
%cd drive/'My Drive'/phantom
この状態でphantom
ディレクトリを Google Drive の GUI 上で削除すると、以下のようなエラーが出るようになる。
!pwd
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
%cd
コマンドなどで現在のディレクトリから移動することもできなくなる。
解決方法:ランタイムを再起動
ツールバーからランタイム>ランタイムを再起動
をクリック。再起動してすべてのセルを実行
でも良い。
これによりカレントディレクトリがリセットされ操作可能となる。