[Python] Colab: No such file or directory

Discussão em 'Python' iniciado por Stack, Fevereiro 26, 2025.

  1. Stack

    Stack Membro Participativo

    I just found a problem about directory making on Colab.


    1. First, I checked the current working directory:

      import os

      !pwd
      >> /content/

    2. Then, I created a sub-directory and checked it as follows.

      data_path = '/content/kaggle_original_data_cats_dogs'
      !mkdir data_path
      !ls /content/
      >> adc.json datalab data_path sample_data sampleSubmission.csv train.zip

    Here, we can see that data_path is the third member of /content/.


    1. However, when I tried to change the working directory to data_path, I got:

      os.chdir(data_path)

      >> FileNotFoundError: [Errno 2] No such file or directory: '/content/kaggle_original_data_cats_dogs'

    So far...I can't figure out what just happened? Is there anything wrong with the lines above?

    Continue reading...

Compartilhe esta Página