add a try catch

This commit is contained in:
jnozsc 2017-09-16 14:02:36 -07:00
parent 12647bc0bd
commit c310b16a80

View file

@ -43,7 +43,11 @@ class DayOne(Journal.Journal):
except (KeyError, pytz.exceptions.UnknownTimeZoneError): except (KeyError, pytz.exceptions.UnknownTimeZoneError):
timezone = tzlocal.get_localzone() timezone = tzlocal.get_localzone()
date = dict_entry['Creation Date'] date = dict_entry['Creation Date']
try:
date = date + timezone.utcoffset(date, is_dst=False) date = date + timezone.utcoffset(date, is_dst=False)
except TypeError:
#(TODO) is_dst issue
pass
raw = dict_entry['Entry Text'] raw = dict_entry['Entry Text']
sep = re.search("\n|[\?!.]+ +\n?", raw) sep = re.search("\n|[\?!.]+ +\n?", raw)
title, body = (raw[:sep.end()], raw[sep.end():]) if sep else (raw, "") title, body = (raw[:sep.end()], raw[sep.end():]) if sep else (raw, "")