0

I'm using python 2.7.x:

import datetime
...
def _log(error_level, message):
  try:
      d = datetime.datetime.now()
      date_template = d.strftime("%Y.%m.%d - %H:%M:%S")
      ...
  except:
      sv_custom_utils.simple_exception_info()

In 99% it is running without any problems, but sometimes I get an error:

ERROR:root:
2018.11.21 - 15:58:25:
  Top:  file: [sv_logger.py], method: _log()
  Root: file: [sv_logger.py], line 51, cause: in _log [date_template = d.strftime("%Y.%m.%d - %H:%M:%S")]
  TypeError: a float is required

What could be a reason? Python is running on Ubuntu 16/18. Does that mean that d should be a float?

IgorZ
  • 1,125
  • 3
  • 20
  • 44
  • I don't know the cause, but this seems relevant: https://stackoverflow.com/a/12400584/3000206 – Carcigenicate Nov 21 '18 at 18:33
  • The code you provided is not enough to reproduce the error. Please read [how to write minimal, complete, and verifiable example](https://stackoverflow.com/help/mcve) – zvone Nov 21 '18 at 20:35
  • I've mentioned that in 99% of the cases it will not be reproduced. That's why I've asked about it. – IgorZ Nov 21 '18 at 20:58

0 Answers0