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.
source https://stackoverflow.com/questions/77643801/fileupload-widget-issue-in-vs-code-ipynb-upload6-displayed-but-data-lengt
Comments
Post a Comment