Answer a question

Here is my code in google colab:

from google.colab import drive
drive.mount('content/drive/My Drive/ML')

I have a path which contains space symbol and I get this error:

/usr/local/lib/python3.6/dist-packages/google/colab/drive.py in mount(mountpoint, force_remount, timeout_ms) 89 90 if ' ' in mountpoint: ---> 91 raise ValueError('Mountpoint must not contain a space.') 92 93 mountpoint = _os.path.expanduser(mountpoint)

ValueError: Mountpoint must not contain a space.

I have tried drive.mount('content/drive/My\ Drive/ML') and this doesn't work

Answers

Run instead:

from google.colab import drive
drive.mount('/content/drive')

The leading / is important. Once mounted at /content/drive, you'll see My Drive/ML in that directory. /content/drive is the directory path on your local machine. My Drive/ML is the path within your Drive. (My Drive distinguishes your Drive from Team drives.)

Logo

Python社区为您提供最前沿的新闻资讯和知识内容

更多推荐