obi grep: made an error message clearer (error could be eventually be

handled by program, looking for str in bytes returned by a column)
This commit is contained in:
Celine Mercier
2019-08-29 17:17:52 +02:00
parent e43e49d6f1
commit 1ed2d45ac4

View File

@ -207,9 +207,12 @@ def Filter_generator(options, tax_filter):
) )
if good and predicates: if good and predicates:
good = (reduce(lambda bint x, bint y: x and y, try:
(bool(eval(p, loc_env, line)) good = (reduce(lambda bint x, bint y: x and y,
for p in predicates), True)) (bool(eval(p, loc_env, line))
for p in predicates), True))
except TypeError:
raise Exception("Try replacing strings in python expression with bytes (by putting 'b' in front of strings, e.g. b'example')")
if good and lmin: if good and lmin:
good = len(line) >= lmin good = len(line) >= lmin