0

I am testing Dash with VS code in Windows 10.

I go to the official website to collect the minimal Dash app. https://dash.plotly.com/minimal-app

The contents (of my file: minimal_dash_app.py) are:

from dash import Dash, html, dcc, callback, Output, Input
import plotly.express as px
import pandas as pd

df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv')

app = Dash(__name__)

app.layout = html.Div([
    html.H1(children='Title of Dash App', style={'textAlign':'center'}),
    dcc.Dropdown(df.country.unique(), 'Canada', id='dropdown-selection'),
    dcc.Graph(id='graph-content')
])

@callback(
    Output('graph-content', 'figure'),
    Input('dropdown-selection', 'value')
)
def update_graph(value):
    dff = df[df.country==value]
    return px.line(dff, x='year', y='pop')

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

When i try to run this, it fails, returning this:

Dash is running on http://127.0.0.1:8050/

 * Serving Flask app 'minimal_dash_app'
 * Debug mode: on
0.02s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
No module named minimal_dash_app

However, when i delete the debug=True part from the last line, it works.

So app.run() works. And also app.run(debug=False) works.

why is this ? And what does debug=True do ?

D.L
  • 4,339
  • 5
  • 22
  • 45
  • Have you tried naming the file `app.py` instead of `minimal_dash_app.py`? – Сергей Кох Aug 20 '23 at 16:32
  • no, because i am testing so would have multiple files with the same name in the same folder if i dod this. But thank you for the suggestion... presumably this is the reason why ? – D.L Aug 21 '23 at 07:40
  • @СергейКох i changed the file to `app.py` and get a similar error message ending with this: `No module named app`. – D.L Aug 21 '23 at 07:55
  • https://stackoverflow.com/questions/22711087/flask-importerror-no-module-named-app – Сергей Кох Aug 21 '23 at 15:09

0 Answers0