Commit 6ca693795f02013bebfbeea5912875aac6129311

Authored by tfmoraes
1 parent d643301e

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,7 +159,11 @@ class Parser():
159 elif(len(sp2) > 1): 159 elif(len(sp2) > 1):
160 data = time.strptime(value, "%H:%M:%S") 160 data = time.strptime(value, "%H:%M:%S")
161 else: 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 return time.strftime("%H:%M:%S",data) 167 return time.strftime("%H:%M:%S",data)
164 168
165 def __format_date(self, value): 169 def __format_date(self, value):