LoginSignup
1
0

More than 3 years have passed since last update.

【Tips】Google Colabolatory の Drive 連携でカレントディレクトリを削除してしまった時の対処方法

Posted at

問題: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 コマンドなどで現在のディレクトリから移動することもできなくなる。

解決方法:ランタイムを再起動

ツールバーからランタイム>ランタイムを再起動をクリック。再起動してすべてのセルを実行でも良い。
image.png

これによりカレントディレクトリがリセットされ操作可能となる。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0