ipyvuetify icon indicating copy to clipboard operation
ipyvuetify copied to clipboard

`FileUpload` makes the Kernel die on `file_obj` read with (ipykernel > 6.29)

Open Alexboiboi opened this issue 6 months ago • 1 comments

Description

When using the FileInput widget from ipyvuetify.extra, file uploads work as expected with ipykernel versions below 6.30. However, with ipykernel 6.30 and above, the widget no longer responds to file uploads and crashes the kernel.

Minimal example:

from ipyvuetify.extra import FileInput

def on_file_input_change(change):
    files = fi.get_files()
    for file in files:
        file["file_obj"].seek(0)
        file["file_obj"].read()

fi = FileInput()
fi.observe(on_file_input_change, names="file_info")
fi

Steps to reproduce:

Install ipykernel<6.30 and run the code above – file uploads work. Upgrade to ipykernel>=6.30 and run the same code – file uploads work up to the read step and then kernel crashes. Expected behavior: File uploads should work with newer versions of ipykernel.

Environment:

OS: Windows ipyvuetify version: 1.11.3 ipykernel version: 6.30+ (broken), 6.29.5 (works) Jupyter environment: [e.g., JupyterLab, VS Code, etc.]

Note

I also tested with ipykernel==7.0.0a1 and the kernel does not crash but the code fails differently: AttributeError: 'IPythonKernel' object has no attribute 'msg_queue'

  • Maybe also relevant for #288

Alexboiboi avatar Aug 13 '25 08:08 Alexboiboi

Hey ipyvuetify :), @mariobuikhuizen thank you for this plugin, the upload widget solves an important issue. I was wondering if this issue will be adressed and if the project is continued.

for now there is a work around which i dont know why it wokrs, but when copying:

from ipyvuetify.extra import FileInput
from ipyvuetify.extra.file_input import ClientSideFile


file_input = FileInput(
    multiple=True,
    label='Click to Select Files',
    v_model=[],
    v_slots=[{
        'name': 'selection',
        'children': ''
    }]
)

try:
    file_input.file_info = [{'name': 'storm110.hdf', 'size': 3487, 'lastModified': 1684766593553, 'type': ''}]
    c = ClientSideFile(file_input,0,1)
    d = c.read()
except:
    file_input.file_info = []

in one cell the issue does not occur, i dont know why, i found it by trying to debug the issue.

RoteKekse avatar Dec 11 '25 10:12 RoteKekse