Hi there. I'm using the commcare-export tool to retrieve my form and case
data from CommCare HQ. I use the str2date function in many of my query
sheets. I'm getting a ValueError when using this function on the
date_closed metadata field. I'm guessing this is because none of my subject
cases have been closed yet. I've pasted the Traceback below. Perhaps there
is a way to modify the str2date function to check for empty cells so that
it won't throw the ValueError. Thanks.
Traceback (most recent call last):
File ".../bin/commcare-export", line 11, in
sys.exit(entry_point())
File ".../lib/python2.7/site-packages/commcare_export/cli.py", line 197,
in entry_point
main(sys.argv[1:])
File ".../lib/python2.7/site-packages/commcare_export/cli.py", line 83,
in main
main_with_args(args)
File ".../lib/python2.7/site-packages/commcare_export/cli.py", line 182,
in main_with_args
writer.write_table(table)
File ".../lib/python2.7/site-packages/commcare_export/writers.py", line
381, in write_table
for row in table['rows']:
File ".../lib/python2.7/site-packages/commcare_export/minilinq.py", line
256, in iterate
yield self.body.eval(env.replace(item))
File ".../lib/python2.7/site-packages/commcare_export/minilinq.py", line
214, in eval
return [item.eval(env) for item in self.items]
File ".../lib/python2.7/site-packages/commcare_export/minilinq.py", line
342, in eval
return fn_result(*args_results)
File ".../lib/python2.7/site-packages/commcare_export/misc.py", line 39,
in _inner
return fn(*([val] if len(args) == 1 else [args[0], val]))
File ".../lib/python2.7/site-packages/commcare_export/env.py", line 245,
in str2date
date = parser.parse(val)
File ".../lib/python2.7/site-packages/dateutil/parser.py", line 1164, in
parse
return DEFAULTPARSER.parse(timestr, **kwargs)
File ".../lib/python2.7/site-packages/dateutil/parser.py", line 574, in
parse
if cday > monthrange(cyear, cmonth)[1]:
File
".../python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/calendar.py",
line 121, in monthrange
day1 = weekday(year, month, 1)
File
".../python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/calendar.py",
line 113, in weekday
return datetime.date(year, month, day).weekday()
ValueError: year is out of range