Commit 6ca693795f02013bebfbeea5912875aac6129311
1 parent
d643301e
Exists in
master
and in
67 other branches
Handling dicom with bad time format
Showing
1 changed file
with
5 additions
and
1 deletions
Show diff stats
invesalius/reader/dicom.py
... | ... | @@ -159,7 +159,11 @@ class Parser(): |
159 | 159 | elif(len(sp2) > 1): |
160 | 160 | data = time.strptime(value, "%H:%M:%S") |
161 | 161 | else: |
162 | - data = time.strptime(value, "%H%M%S") | |
162 | + try: | |
163 | + data = time.strptime(value, "%H%M%S") | |
164 | + # If the time is not in a bad format only return it. | |
165 | + except ValueError: | |
166 | + return value | |
163 | 167 | return time.strftime("%H:%M:%S",data) |
164 | 168 | |
165 | 169 | def __format_date(self, value): | ... | ... |