Skip to content

Time2Internaldate is not working with int or float time #52

Open
@iliyan85

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions