1. Fabric Portal Jupytur Not Finding File

Fabric Portal Jupytur Not Finding File

Home Forums FABRIC General Questions and Discussion Fabric Portal Jupytur Not Finding File

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6127

    I uploaded an image file, and for some reason it cannot find the file even after giving the absolute path.

    import PIL
    import matplotlib.pyplot as plt
    import os
    import pandas as pd
    filename = os.path.join(os.getcwd(), ‘animal-blur-canine-551628.jpg’)
    # upload your image here
    img = PIL.Image.open(filename)
    # Resize image to 224×224
    img = img.resize((224, 224))
    # Print image before any changes
    plt.imshow(img)

     

    Error:

    FileNotFoundError                         Traceback (most recent call last)
    Cell In[28], line 7
          5 filename = os.path.join(os.getcwd(), 'animal-blur-canine-551628.jpg')
          6 # upload your image here
    ----> 7 img = PIL.Image.open(filename)
          8 # Resize image to 224x224
          9 img = img.resize((224, 224))
    
    File /opt/conda/lib/python3.10/site-packages/PIL/Image.py:3218, in open(fp, mode, formats)
       3215     filename = fp
       3217 if filename:
    -> 3218     fp = builtins.open(filename, "rb")
       3219     exclusive_fp = True
       3221 try:
    
    FileNotFoundError: [Errno 2] No such file or directory: '/home/fabric/work/re_vit/notebooks/animal-blur-canine-551628.jpg'
    #6138
    Komal Thareja
    Participant

      Hello,

      Could you please check if the file exists at the specified path using the command: ls /home/fabric/work/re_vit/notebooks/animal-blur-canine-551628.jpg ?

      Thanks,
      Komal

      #6139

      I was able to figure it out. Thank you.

    Viewing 3 posts - 1 through 3 (of 3 total)
    • You must be logged in to reply to this topic.