Black Lives Matter. Please consider donating to Black Girls Code today.

Dash python : How to fill dcc.dropdown with csv content?

I would like to create an web app in python and Dash. The first that I try is to create a dropdown.

I’ve these data :

Date,FS,Total,Used,Mount
2019-10-08-13-37;/dev/hd4;1024.00;138.21;/
2019-10-08-13-37;/dev/hd2;5248.00;4231.2;/usr
2019-10-08-13-37;/dev/hd2;2560.00;490.48;/var
2019-10-08-13-37;/dev/hd3;3584.00;67.58;/tmp
2019-10-08-13-37;/dev/hd1;256.00;26.25;/home
2019-10-08-13-37;/dev/hd1;1024.00;476.03;/opt
2019-10-08-13-37;/dev/hd3;384.00;0.38;/usr/esm
2019-10-08-13-37;/dev/hd2;256.00;21.38;/exploit
2019-10-08-13-37;/dev/hd1;512.00;216.84;/opt/Tivoli
2019-10-08-13-37;/dev/hd1;128.00;21.46;/var/adm/ras/audit
2019-10-08-13-37;/dev/hd4;256.00;75.21;/usr/es
2019-10-08-13-37;/dev/hd5;384.00;192.21;/var/hacmp

I would like to create a dropdown with all the FS of my CSV. I try that :

import dash
import dash_core_components as dcc
import dash_html_components as html
import sys
import os
import pandas as pd 

app = dash.Dash


df = pd.read_csv('/xxx/xxx/xxx/xxx/xxx/xxx/data.txt')

test = df['FS'].unique()

dcc.Dropdown(
    options=[test],
    searchable=False
)  

if __name__ == '__main__':
    app.run_server(debug=True)

But the output is

Traceback (most recent call last):
  File "./import dash.py", line 25, in <module>
    app.run_server(debug=True)
TypeError: run_server() missing 1 required positional argument: 'self'

Can you tell me why ?

see https://dash.plot.ly/dash-core-components/dropdown for some examples.

Your app = dash.Dash should be app = dash.Dash(__name__) at a minimum.

Also, see the example(s) on how to define your layout.