From a8e329f4cf38f0ee4a6c4af92779cfa0c7b274cf Mon Sep 17 00:00:00 2001 From: ostrichb Date: Sun, 6 Nov 2022 08:25:45 +0000 Subject: [PATCH] added traceback --- scripts/main.py | 12 ++++++------ scripts/o365_util.py | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/main.py b/scripts/main.py index 3f833a2..3f796b0 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -53,15 +53,15 @@ if __name__ == '__main__': ], title="Setting the API", form_height=5) - if choice0 == "cancel": - break + if choice0 == d.CANCEL: + exit(2) (choice1, routine_mode) = d.menu("Choose the routine mode listed below.", width=54, choices=[("Fixed", "Fixed interval between each routine."), ("Ranged", "Randomly picks an interval in a range.")], title="Routine Mode") - if choice1 == "cancel": - break + if choice1 == d.CANCEL: + exit(2) else: if routine_mode == "Fixed": (choice2, interval) = d.inputbox("Enter the interval during each routine, in seconds", @@ -88,7 +88,7 @@ if __name__ == '__main__': for item in interval: item = int(item) if choice2 == "cancel": - break + exit(2) business_hour = True if d.yesno("Do you wanna enable business hours mode?\n" "If you enabled this, the API will be only called from 9 to 5, " "from Monday to Friday.", @@ -99,7 +99,7 @@ if __name__ == '__main__': else parsed_arguments.temp_file_threshold), title="Temporary file threshold") if choice4 == "Cancel": - break + exit(2) # Conclusion if d.yesno("You've selected:\n" "Client ID: {0}\n" diff --git a/scripts/o365_util.py b/scripts/o365_util.py index f233331..56a1b6b 100644 --- a/scripts/o365_util.py +++ b/scripts/o365_util.py @@ -6,6 +6,7 @@ import pathlib import random import pause import readline +import traceback import datetime as dt from O365 import drive as d from O365 import mailbox as mb @@ -124,6 +125,7 @@ class O365_User: if is_interactive: dlg.gauge_stop() logging.error(e) + logging.error(traceback.format_exc()) logging.error("AN error occurred, the circulation will be jumped " "to the end and wait for the next turn.")