Catch ValueErrors caused by missing points after month abreviation in RED_PAGE_PARSER.__timestamp
This commit is contained in:
@@ -59,6 +59,7 @@ class RED_FAM_PARSER( RED_FAM ):
|
||||
|
||||
# Define the timestamp format
|
||||
__timestamp_format = "%H:%M, %d. %b. %Y (%Z)"
|
||||
__timestamp_format2 = "%H:%M, %d. %b %Y (%Z)" # Catch missing point after month abreviation
|
||||
|
||||
# Define section heading re.pattern
|
||||
__sectionhead_pat = re.compile( r"={3,4}[^=]*={3,4}" )
|
||||
@@ -179,7 +180,12 @@ class RED_FAM_PARSER( RED_FAM ):
|
||||
if( isinstance( timestamp, datetime ) ):
|
||||
return timestamp
|
||||
else:
|
||||
return datetime.strptime( timestamp, type( self ).__timestamp_format )
|
||||
# Catch missing point after month abreviation
|
||||
try:
|
||||
result = datetime.strptime( timestamp, type( self ).__timestamp_format )
|
||||
except ValueError:
|
||||
result = datetime.strptime( timestamp, type( self ).__timestamp_format2 )
|
||||
return result
|
||||
|
||||
def status( self ):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user