Retrieving the filename property of the FileInput widget

Hello! Brand new to Bokeh and not a Python person either (yet). Having said that, I have been able to create a substantial Notebook that reads and plots some fairly complex data, so starting to get the hang of things, but clearly don’t understand how the FileInput widget works. I just want to use it as a selector, then load the file on my own by retrieving the filename property from the widget. The screencap below is probably the quickest way of showing both what I want and what is not working as I expect:

As you can see, I have chosen a file, but it appears that the filename property does not persist after the widget has been run. Is that correct? Am I misusing the widget?



@akucheck What you are generating above is “standalone” output. The code uses to Bokeh to create static HTML/JS output, and then is done, completely out of the picture. There is no further connection or communication with any Python process.

If you want a bi-directional connection, where UI events trigger Python code, and Python code can update data to update the UI, then you need to create and run a Bokeh server application (this sort of usage is the entire purpose of the Bokeh server)

It is possible to embed Bokeh server applications in notebooks, there are links to examples down that page.

Super, thanks! Will look into that next.


1 Like