Skip to content

Commit

Permalink
Note habit list bug
Browse files Browse the repository at this point in the history
  • Loading branch information
durden committed Jan 11, 2014
1 parent 4099ed6 commit 8149191
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dayonetools/services/habit_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
- Choose the 'Export Data' option
- E-mail the data to yourself
- Copy and paste the e-mail contents into a file of your choosing
- DO NOT REMOVE THE EXTRA THREE LINES OF THE E-MAIL. WE CURRENTLY HAVE
A BUG THAT EXPECTS THESE THREE LINES
- You can choose to optionally remove the first few lines of the e-mail
that are not JSON data, everything up to the first '[' character.
- Again, this is optional because this module will attempt to ignore
Expand Down Expand Up @@ -211,6 +213,8 @@ def parse_habits_file(filename, start_date=None):
"""

with open(filename, 'r') as file_obj:
# FIXME: This expects 3 lines of junk at the beginning of the file, but
# we could just read until we find '[' and ignore up until that point.
junk = file_obj.readline()
junk = file_obj.readline()
junk = file_obj.readline()
Expand All @@ -231,6 +235,8 @@ def parse_habits_file(filename, start_date=None):
# anything to yield values as they come b/c we won't know if we've parsed
# the entire day until all JSON is parsed.

# FIXME: Should have something to catch ValueError exceptions around this
# so we can show the line with the error if something is wrong.
for habit in json.loads(_json):
name = habit['name']

Expand Down

0 comments on commit 8149191

Please sign in to comment.