Open aadilayub opened 3 years ago
I uncommented the line that writes to errors.log
, this is the result:
unconverted data remains: T17:0
According to this StackOverflow question, the problem is with how the strptime
function is being used.
The relevant lines in todo.py
are:
def item_due_today(dueDate):
dueDate = dueDate[:15]
dueTimestamp = datetime.strptime(dueDate, '%Y-%m-%d')
today = datetime.today()
and
if dueDate is not None:
dueDate = dueDate[:15]
dueTimestamp = datetime.strptime(dueDate, '%Y-%m-%d')
From the shell output:
Traceback (most recent call last):
File "/home/aadil/.config/polybar/todoist/todo.py", line 96, in main
print_loop(api, args.prefix, args.weekly)
File "/home/aadil/.config/polybar/todoist/todo.py", line 55, in print_loop
dueToday = due_today_count(api)
File "/home/aadil/.config/polybar/todoist/todo.py", line 26, in due_today_count
if dueDate is not None and item_due_today(dueDate) and not completed:
File "/home/aadil/.config/polybar/todoist/todo.py", line 13, in item_due_today
dueTimestamp = datetime.strptime(dueDate, '%Y-%m-%d')
File "/usr/lib64/python3.9/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/lib64/python3.9/_strptime.py", line 352, in _strptime
raise ValueError("unconverted data remains: %s" %
ValueError: unconverted data remains: T17:0
of note:
File "/usr/lib64/python3.9/_strptime.py", line 352, in _strptime
raise ValueError("unconverted data remains: %s" %
does this mean %s
needs to be added to our datetime format string? I tried changing it to %Y-%m-%d%s
and %Y-%m-%d%S
but that gave '%s' is a bad directive in format '%s'
and "time data %r does not match format %r"
respectively
For the last 2 days, my tasks indicator looks like this:
I took a look at the code to diagnose the issue:
It looks like the program is printing a tilde instead of the taskcount because of
print(f'{ICON} ~', flush=True)
which runs when the program is throwing an exception.Any clue as to what could be causing this? AFAIK todoist hasn't announced any breaking API changes.