Incorrect time data throws exception
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)
-
-
- changed milestone to 0.8.0
- changed component to Import: All
-
Better test for None/empty string. Added each call to strptime to try. Refs
#568→ <<cset cd2beb0acdbd>>
-
Correcting a few non-related issues while we're here. Refs
#568→ <<cset 3751e1de2947>>
-
-
assigned issue to
-
assigned issue to
-
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.
-
Added ref
#568to changes→ <<cset f5c856eb02e3>>
-
Put all the calls to strptime into the try except ValueError test. Refs
#568→ <<cset aff30358b6bf>>
-
Removed the duplication in dcmdatetime by making the get_ style functions make use of the make_ style functions. Refs
#568→ <<cset 2ad50da0e8dc>>
-
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
-
Thanks Ben. Don't worry about it. I might throw some more tests in to the testing suite instead :-)
-
Starting to add tests for the date and time conversions. Refs
#568→ <<cset 596bae5e7a5b>>
-
Finished the time and date tests I think. Required a rewrite of the DCM date range function. Refs
#568→ <<cset 242fe94331a8>>
-
Fraction more coverage hopefully. Refs
#568→ <<cset b1ceb6672303>>
-
Correcting changes message. Refs
#568→ <<cset a2fa1d0c4026>>
-
- changed status to resolved
Fixed in merge e2c5120 of Pull Request #146
- Log in to comment
Thanks for this bug report @bearner - nice easy one to fix :-)