datetime.strptime(dt_str, dt_func)

Code:
datetime.strptime(dt_str, dt_func)

Usually work fine but sometimes i receive this error:

Code:
attribute of type 'NoneType' is not callable

Now i check the error and all seem fine with dt_str and dt_func:
dt_str: 2017-01-22
dt_func: %Y-%m-%d

any idea? or alternative method to create a date from a string?