From 416851bf99e1be973ecbb996d20038be5e527f0a Mon Sep 17 00:00:00 2001 From: nsubiron Date: Tue, 2 Jul 2019 10:58:29 +0200 Subject: [PATCH] Do not crash Python script when users cancel --- PythonAPI/examples/synchronous_mode.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PythonAPI/examples/synchronous_mode.py b/PythonAPI/examples/synchronous_mode.py index 8d645d1ce..449e9865d 100755 --- a/PythonAPI/examples/synchronous_mode.py +++ b/PythonAPI/examples/synchronous_mode.py @@ -197,4 +197,9 @@ def main(): if __name__ == '__main__': - main() + try: + + main() + + except KeyboardInterrupt: + print('\nCancelled by user. Bye!')