None returned to FileInput
Hello,
I am trying to include large files via the FileInput widget. Effectively, this is something like this:
import panel as pn
import xarray as xr
pn.extension()
uploader = pn.widgets.FileInput()
uploader.save(uploader.filename) # Assume filename is a NetCDF file
ds = xr.open_dataset(uploader.filename)
This works fine as long as the files are small (I tested with a few kbytes). However, if they get large, I get back:
AttributeError: 'NoneType' object has no attribute 'write'
I guess because the file hasn't uploaded all the way yet. If that's the case, would it be possible to block the program and display some sort of progress bar?
@pgierz is the code you shared exactly what you were executing? Was it in a notebook?
I had some old code that watched the 'value' param, but then this triggered accessing the widgets filename .
This code worked for a long time, but updating to the following versions, I had the same issue.
panel 0.12.6
bokeh 2.4.2
Have updated the code to watch the filename and its working again. I wonder if it's a similar issue..
-- _watcher = self.upload.param.watch(self.on_hdf_import, parameter_names=['value'])
++ _watcher = self.upload.param.watch(self.on_hdf_import, parameter_names=['filename'])
Seems likely that it's syncing the data first and then the filename and the larger the file the more likely the callback gets called before the filename is updated.