Incorrect time data throws exception

Issue #568 resolved
Ben Earner created an issue

See trace below:

Traceback (most recent call last):
  File "/home/physics/Envs/OpenREM-dev/bin/", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/physics/Envs/OpenREM-dev/openremdev/openrem/scripts/", line 24, in <module>
  File "/home/physics/Envs/OpenREM-dev/local/lib/python2.7/site-packages/celery/", line 191, in __call__
    return self._get_current_object()(*a, **kw)
  File "/home/physics/Envs/OpenREM-dev/local/lib/python2.7/site-packages/celery/app/", line 379, in __call__
    return*args, **kwargs)
  File "/home/physics/Envs/OpenREM-dev/openremdev/openrem/remapp/extractors/", line 588, in mam
  File "/home/physics/Envs/OpenREM-dev/openremdev/openrem/remapp/extractors/", line 501, in _mammo2db
  File "/home/physics/Envs/OpenREM-dev/openremdev/openrem/remapp/extractors/", line 465, in _create_event
    event_date_time = make_date_time('{0}{1}'.format(event_date, event_time))
  File "/home/physics/Envs/OpenREM-dev/openremdev/openrem/remapp/tools/", line 140, in make_date_time
    return datetime.datetime.strptime(dicomdatetime, "%Y%m%d")
  File "/usr/lib/python2.7/", line 332, in _strptime
    (data_string, format))
ValueError: time data 'NoneNone' does not match format '%Y%m%d'

Comments (16)

  1. Ed McDonagh

    Hi @bearner, I've made the fix in the issue568timeexception branch. I don't know if you are in a position to test it? Or if you can throw me a file with the missing dates?

    Otherwise I'll merge it in.

    Thanks again.

  2. Ben Earner reporter

    Hi Ed,

    I'm afraid it's unlikely I'll be able to re-create the issue as I found the exception in the logs from an overnight dicom Q/R, Unfortunately I have no idea which file caused the issue. So I can pull in the branch and leave it running but I have no idea if the kind of file the caused the problem will be seen as we have so many units that are used at varying frequencies. So maybe merging is the best option for now?



  3. Ed McDonagh

    Thanks Ben. Don't worry about it. I might throw some more tests in to the testing suite instead :-)

  4. Log in to comment