Hi there,
I try to use this example code to just read a csv and display. I already ran this code using an example csv without issue. (The code is just to show where the print
function is inserted. It’s not complete code.) However when I use my own csv file, the print(list_of_contents)
function in the callback printed ['']
. Moreover the print(list_of_names)
still gives me correct filename. My file is 469MB in size. the file name has 64 characters. There is no error message. I am thinking that the Upload
probably initiates an empty string then read in the binary, so something broke the read in binary part causing it to only output an empty string. Is my file too big?
app.layout = html.Div([
html.Div(children = [
dcc.Upload(
id='upload-data',
children=html.Div([
'Drag and Drop or ',
html.A('Select Files')
]),
style={
'width': '100%',
'height': '60px',
'lineHeight': '60px',
'borderWidth': '1px',
'borderStyle': 'dashed',
'borderRadius': '5px',
'textAlign': 'center',
'margin': '10px'
},
# Allow multiple files to be uploaded
multiple=True
)],
style={'display': 'inline-block', 'padding': '20px'}),
html.Div(id='input-filename',
style={'display': 'inline-block', 'padding': '20px'}),
]),
@callback([Output('data-table-upload', 'children'),
Output('store-filter-map', 'data'),
Output('store-method-map', 'data')],
Input('upload-data', 'contents'),
State('upload-data', 'filename'),
State('upload-data', 'last_modified'),
prevent_initial_call=True)
def update_output(list_of_contents, list_of_names, list_of_dates):
if list_of_contents is not None:
print(list_of_contents)
print(list_of_names)
children = [
parse_contents(c, n, d) for c, n, d in
zip(list_of_contents, list_of_names, list_of_dates)]
this_filter_map = ftmap.get_filter_map()
this_method_map = fxmap.get_method_map()
return children, json.dumps(this_filter_map), json.dumps(this_method_map)