spyder: Stopping script with Ctrl+C in the console is not working

Hi I am running the following dash script. Stopping the server with Ctrl-C in the console is not working on my Windows 10, Python 3.7.0 machine using spyder 3: ` # -- coding: utf-8 -- import dash import dash_core_components as dcc import dash_html_components as html

# external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__)
app.layout = html.Div(children=[
    html.H1(children='Example Dash'),

    html.Div(children='''
        Dash: A web application framework for Python.
    '''),

    dcc.Graph(
        id='example-graph',
        figure={
            'data': [
                {'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
                {'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
            ],
            'layout': {
                'title': 'Dash Data Visualization'
            }
        }
    )
])

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

` I replaced Version 3 by the development version 4 where Ctrl-C is working as expected.

Cheers Renger

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 18 (12 by maintainers)

Most upvoted comments

I’m very much not a WSGI/web server expert, but if I were to guess, either one or both of the following may occurring:

  • Flask is spawning subprocesses to handle the actual web requests, which are not getting killed properly, and/or
  • Flask is trapping the either the actual keyboard interrupt signal, or the KeyboardInterruptError Python-level exception, and instead of exiting, it instead relaunches new subprocesses in debug mode

Then, when it is run again, it launches another set of them.