From 3e6b8706c39b04faa90496bf54f11bf04587ee15 Mon Sep 17 00:00:00 2001 From: Waishnav Date: Sun, 13 Mar 2022 21:57:42 +0530 Subject: exception handling in watcher executable file --- src/Watcher/week_analysis.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Watcher/week_analysis.py') diff --git a/src/Watcher/week_analysis.py b/src/Watcher/week_analysis.py index 1f064b2..a82b5f3 100755 --- a/src/Watcher/week_analysis.py +++ b/src/Watcher/week_analysis.py @@ -10,7 +10,7 @@ def get_dates(): # The start of the week start = theday - datetime.timedelta(days=weekday) # build a simple range - dates = [start + datetime.timedelta(days=d) for d in range(weekday+1)] + dates = [start + datetime.timedelta(days=d) for d in range(weekday + 1)] dates = [str(d) for d in dates] return dates @@ -19,7 +19,7 @@ def weekday_from_date(date): day = os.popen('''date -d "'''+ date + '''" +%a''').read() return day[0:-1] -W_Y = os.popen('''date +"W%U-%Y"''').read()[0:-1] +W_Y = os.popen('''date +"W%V-%Y"''').read()[0:-1] user = os.getlogin() filename = "/home/"+user+"/.cache/Watcher/Analysis/"+W_Y+".csv" with open(filename, "w") as csvfile: @@ -39,7 +39,7 @@ with open(filename, "w") as csvfile: for i in dates: x, y = rc.extract_data(str(i)) - window_opened += x # smth is wrong here + window_opened += x time_spent += y for x, y in rc.final_report(window_opened, time_spent).items(): csvwriter.writerow([y, x]) -- cgit v1.2.3