I'm trying to use a jupyter file upload widget (ipywidgets/ipyvuetify..) to read a file from my local machine in a databricks notebook.
I considered ipywidgets, but databricks doesn't seem to support the file upload feature in ipywidgets - https://docs.databricks.com/notebooks/ipywidgets.html#limitations
I found another widget library called ipyvuetify.
This is the code I tried. Picking the file works as expected.
from ipyvuetify.extra import FileInput
file_input = FileInput()
file_input
files = file_input.get_files()
data = files[0]['file_obj'].read()
data
I get this timeout exception when I try the read() above -
Exception Traceback (most recent call last)
File <command-2037501063098494>:1
----> 1 data = files[0]['file_obj'].read()
2 data
File /lib/python3.9/site-packages/ipyvuetify/extra/file_input.py:147, in ClientSideFile.readall(self)
146 def readall(self):
--> 147 return self.read(self.size - self.offset)
File /lib/python3.9/site-packages/ipyvuetify/extra/file_input.py:143, in ClientSideFile.readinto(self, buffer)
140 self.widget.update_stats(self.file_index, chunk_size)
141 await process_messages()
--> 143 asyncio.run(read_all())
144 return size
File /databricks/python/lib/python3.9/site-packages/nest_asyncio.py:35, in _patch_asyncio.<locals>.run(main, debug)
33 task = asyncio.ensure_future(main)
34 try:
Other related stackoverflow question -
ipyvuetify file selection
github issue -
file upload widget
Would really appreciate any input solving this, or if anyone has done something similar in databricks.