databaker
databaker copied to clipboard
assert_one() failures are noisy and unfriendly
Traceback (most recent call last):
File "/home/me/.virtualenvs/databaker/bin/bake", line 11, in <module>
sys.exit(main())
File "/home/me/.virtualenvs/databaker/local/lib/python2.7/site-packages/databaker/bake.py", line 328, in main
per_file(fn, recipe)
File "/home/me/.virtualenvs/databaker/local/lib/python2.7/site-packages/databaker/bake.py", line 272, in per_file
obs = recipe.per_tab(tab)
File "a02.py", line 7, in per_tab
obs = tab.filter("All Persons").assert_one().shift(DOWN)
File "/home/me/.virtualenvs/databaker/local/lib/python2.7/site-packages/xypath/xypath.py", line 425, in assert_one
len(self.__store)
xypath.xypath.MultipleCellsAssertionError: assert_one() : 2 cells in bag, not 1
exit: 0.089s, 3.129s total
Perhaps it should show the full output if --debug
is enabled and otherwise something more concise like so that the user can immediately see the problem:
2 cells in bag, not 1 found in:
File "a02.py", line 7, in per_tab
obs = tab.filter("All Persons").assert_one().shift(DOWN)
:+1:
https://github.com/scraperwiki/databaker/pull/32