diff --git a/python/obitools3/commands/grep.pyx b/python/obitools3/commands/grep.pyx index a32995d..78bb516 100644 --- a/python/obitools3/commands/grep.pyx +++ b/python/obitools3/commands/grep.pyx @@ -207,9 +207,12 @@ def Filter_generator(options, tax_filter): ) if good and predicates: - good = (reduce(lambda bint x, bint y: x and y, - (bool(eval(p, loc_env, line)) - for p in predicates), True)) + try: + good = (reduce(lambda bint x, bint y: x and y, + (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: good = len(line) >= lmin