From 6ca693795f02013bebfbeea5912875aac6129311 Mon Sep 17 00:00:00 2001 From: tfmoraes Date: Mon, 11 Apr 2011 15:32:10 +0000 Subject: [PATCH] Handling dicom with bad time format --- invesalius/reader/dicom.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/invesalius/reader/dicom.py b/invesalius/reader/dicom.py index 9c77e53..3c0dfe7 100644 --- a/invesalius/reader/dicom.py +++ b/invesalius/reader/dicom.py @@ -159,7 +159,11 @@ class Parser(): elif(len(sp2) > 1): data = time.strptime(value, "%H:%M:%S") else: - data = time.strptime(value, "%H%M%S") + try: + data = time.strptime(value, "%H%M%S") + # If the time is not in a bad format only return it. + except ValueError: + return value return time.strftime("%H:%M:%S",data) def __format_date(self, value): -- libgit2 0.21.2