PIL Image display error in Windows 'It appears that the file was moved or renamed'

483 views Asked by At

I have just started using PIL in Python, and tried to open an image. Code below:

def openImage():
    
    PATH = input(f'Enter Path:\n> ')

    PATH = PATH.replace('"','')
    Image = I.open(PATH)

    OPEN = f'Opening image file at {PATH} ..'
    print(f'\n{OPEN}')

    Image.show()

It opened and appeared for a second but then this appeared:

It appears that the file was moved or renamed

I googled for this error, only to realise that this happens with using PIL in Windows, since it converts it into a temporary .bmp file to open, and then it gets deleted as soon as the original one is closed, that's why the error.

Someone even asked the same question earlier here on StackOverflow, but no constructive solution was found.

Any help will be appreciated! Thanks in advance.

0

There are 0 answers