Hi all!
I have a bokeh app using FileInput. However when i tried to get filename and value cannot getting the filename because of the problem i mentioned below.
Basic code:
fn=[]
def get_filename(attr, old, new):
global fn
fn.append(new)
print(new + " is selected")
def upload_file(attr, old, new):
# some codes
print("--------")
print(fn)
file_input = FileInput(name="fileinput", accept=".csv")
file_input.on_change('filename', get_filename)
file_input.on_change('value', upload_file)
and it returns:
[]
filename.csv is selected
It’s because upload_file function start first somehow. It shouldn’t be. Do you know guys the reason or any method to get filename and value from FileInput in the same time? I tried couple of things but everytime upload_file function is the first one to start, so i cannot getting the filename in that function.