Open
Description
time.time() or other int or float value throws an exception when it is using as date_time input for Time2Internaldate function.
The error message is:
UnboundLocalError: cannot access local variable 'dt' where it is not associated with a value
if isinstance(date_time, (int, float)): #time.time() returns True
tt = time.localtime(date_time)
and after that
fmt = '"%d-{}-%Y %H:%M:%S %z"'.format(MonthNames[dt.month])
'dt' cannot be used.
Time2Internaldate works correctly by the following way:
dt = datetime.datetime.now(pytz.timezone('Europe/Sofia'))
imaplib2.Time2Internaldate(dt)
Activity