0

One of my data analysis application I am using Brute force search method for finding similar patterns, the possible conditions will be millions.

For better performance all the results are store in the memory and will write into database every hours.

But now I can't stop the application in middle, So how i can give a exit command(like a command or shortcut key) to the application through command prompt, so it will write all the results into database from memory and call exit function (like sys.exit() ).

Can I accomplish this by using argparse or modules like click?. I couldn't find any examples.

0

1 Answer 1

2

You can have the user press Ctrl+C, and in your program catch the KeyboardInterrupt exception and write your output there.

Sign up to request clarification or add additional context in comments.

1 Comment

You can also use CTRL + \ (backslash), which sends a SIGQUIT.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.