question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
CAM-Gerlachcommented, Aug 16, 2022

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.

0reactions
CAM-Gerlachcommented, Aug 16, 2022

@SwethA99hub , could you run jupyter qtconsole in your working environment and try to reproduce your issue in there? What about if you run ipython?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ctrl+C does not stop script in Console? - SAPIEN Forums
PowerShell Version: 4.0. When script is running in Console, sometimes I wanted to stop it from running. But Ctrl+C won't work?
Read more >
Node JS ctrl + C doesn't stop server (after starting server with ...
I was trying to get json-server to quit a custom server script, but it always left a child process running on Windows.
Read more >
CTRL+C and CTRL+BREAK Signals - Windows Console
Normal CTRL+C processing is restored by calling SetConsoleCtrlHandler with NULL and FALSE values. This attribute of ignoring or not ignoring ...
Read more >
What to do when Ctrl-C won't kill running job? - Ask Ubuntu
Send the SIGQUIT signal with Ctrl + \ . .. $ sleep 10 ^\Quit. → This is equivalent to kill -3 pid ....
Read more >
MySQL console: Ctrl+C driving me nuts
Isn't this potentially dangerous? There's no guarantee that it would work for future versions. Plus, it looks like it'd work, but how would...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found