FileUpload Widget Issue in VS Code .ipynb: 'Upload(6)' Displayed, but data Length Returns 0

34 views Asked by At

I was trying to upload a file using widget.FileUpload() and print the image out. But after uploading 6 images and trying to run the last line in a new cell it returned an error, saying "IndexError: list index out of range"

btn_upload = widgets.FileUpload()
btn_upload


img = PILImage.create(btn_upload.data[-1])

I then tried the line print("Number of uploaded files:", len(btn_upload.data)) expecting "6" as that is the number of files I uploaded, it returned 0 instead.

0

There are 0 answers