fixed problem when condition was empty

This commit is contained in:
Philip Eisenlohr 2012-02-16 18:00:40 +00:00
parent f2729255f8
commit a994b4bcc9
1 changed files with 3 additions and 3 deletions

View File

@ -44,7 +44,7 @@ parser.add_option('-c','--condition', dest='condition', type='string', \
parser.set_defaults(whitelist = [])
parser.set_defaults(blacklist = [])
parser.set_defaults(condition = '')
parser.set_defaults(condition = 'True')
(options,filenames) = parser.parse_args()
@ -93,7 +93,7 @@ for file in files:
parser.error('column %s not found...\n'%operand)
evaluator = "'" + options.condition + "'.format(" + ','.join(interpolator) + ")"
# ------------------------------------------ assemble header ---------------------------------------
table.labels = labels # update with new label set
@ -105,7 +105,7 @@ for file in files:
specials['_row_'] += 1 # count row
if eval(eval(evaluator)): # valid row ?
if options.condition != '' and eval(eval(evaluator)): # valid row ?
table.data = [table.data[position] for position in positions] # retain filtered columns
table.data_write() # output processed line