[Python] Not able to load image using PIL

Discussão em 'Python' iniciado por Stack, Julho 6, 2025.

  1. Stack

    Stack Membro Participativo

    Why would the object im_test be None for the below code:

    import io
    import os
    from PIL import Image

    test_image=os.path.join("/content","drive","MyDrive","Colab Notebooks","prediction.png")
    m_test=Image.open(test_image)
    im_test.verify()
    im_test.load()



    The error I get is :


    AttributeError: 'NoneType' object has no attribute 'seek'
    ​

    I want to pass the object im_test to the function learn.predict function of fastai and currently unable to. Looking for fixes. Thank you

    Continue reading...

Compartilhe esta Página