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/openrem_mg.py", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/physics/Envs/OpenREM-dev/openremdev/openrem/scripts/openrem_mg.py", line 24, in <module>
    mam(filename)
  File "/home/physics/Envs/OpenREM-dev/local/lib/python2.7/site-packages/celery/local.py", 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/task.py", line 379, in __call__
    return self.run(*args, **kwargs)
  File "/home/physics/Envs/OpenREM-dev/openremdev/openrem/remapp/extractors/mam.py", line 588, in mam
    _mammo2db(dataset)
  File "/home/physics/Envs/OpenREM-dev/openremdev/openrem/remapp/extractors/mam.py", line 501, in _mammo2db
    _create_event(dataset)
  File "/home/physics/Envs/OpenREM-dev/openremdev/openrem/remapp/extractors/mam.py", 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/dcmdatetime.py", line 140, in make_date_time
    return datetime.datetime.strptime(dicomdatetime, "%Y%m%d")
  File "/usr/lib/python2.7/_strptime.py", 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?

    Thanks,

    Ben

  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