bug fixing
This commit is contained in:
parent
f982f42839
commit
7ca1e77495
|
@ -90,13 +90,14 @@ if options.vector == None and options.tensor == None:
|
||||||
|
|
||||||
# --- loop over input files -------------------------------------------------------------------------
|
# --- loop over input files -------------------------------------------------------------------------
|
||||||
|
|
||||||
if filenames == []: filenames = ['STDIN']
|
if filenames == []: filenames = [None]
|
||||||
|
|
||||||
for name in filenames:
|
for name in filenames:
|
||||||
if not (name == 'STDIN' or os.path.exists(name)): continue
|
try:
|
||||||
table = damask.ASCIItable(name = name, outname = name+'_tmp',
|
table = damask.ASCIItable(name = name,buffered = False)
|
||||||
buffered = False)
|
except:
|
||||||
table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else ''))
|
continue
|
||||||
|
table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else ''))
|
||||||
|
|
||||||
# ------------------------------------------ read header ------------------------------------------
|
# ------------------------------------------ read header ------------------------------------------
|
||||||
|
|
||||||
|
@ -116,7 +117,7 @@ for name in filenames:
|
||||||
else: coordCol = table.label_index(options.coords)
|
else: coordCol = table.label_index(options.coords)
|
||||||
|
|
||||||
for type, data in items.iteritems():
|
for type, data in items.iteritems():
|
||||||
for what in data['labels']:
|
for what in (data['labels'] if data['labels'] is not None else []):
|
||||||
dim = table.label_dimension(what)
|
dim = table.label_dimension(what)
|
||||||
if dim != data['dim']: remarks.append('column {} is not a {}.'.format(what,type))
|
if dim != data['dim']: remarks.append('column {} is not a {}.'.format(what,type))
|
||||||
else:
|
else:
|
||||||
|
@ -171,4 +172,3 @@ for name in filenames:
|
||||||
# ------------------------------------------ output finalization -----------------------------------
|
# ------------------------------------------ output finalization -----------------------------------
|
||||||
|
|
||||||
table.close() # close input ASCII table (works for stdin)
|
table.close() # close input ASCII table (works for stdin)
|
||||||
if name != 'STDIN': os.rename(name+'_tmp',name) # overwrite old one with tmp new
|
|
||||||
|
|
|
@ -75,13 +75,14 @@ if options.vector == None and options.tensor == None:
|
||||||
|
|
||||||
# --- loop over input files -------------------------------------------------------------------------
|
# --- loop over input files -------------------------------------------------------------------------
|
||||||
|
|
||||||
if filenames == []: filenames = ['STDIN']
|
if filenames == []: filenames = [None]
|
||||||
|
|
||||||
for name in filenames:
|
for name in filenames:
|
||||||
if not (name == 'STDIN' or os.path.exists(name)): continue
|
try:
|
||||||
table = damask.ASCIItable(name = name, outname = name+'_tmp',
|
table = damask.ASCIItable(name = name,buffered = False)
|
||||||
buffered = False)
|
except:
|
||||||
table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else ''))
|
continue
|
||||||
|
table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else ''))
|
||||||
|
|
||||||
# ------------------------------------------ read header ------------------------------------------
|
# ------------------------------------------ read header ------------------------------------------
|
||||||
|
|
||||||
|
@ -101,7 +102,7 @@ for name in filenames:
|
||||||
else: coordCol = table.label_index(options.coords)
|
else: coordCol = table.label_index(options.coords)
|
||||||
|
|
||||||
for type, data in items.iteritems():
|
for type, data in items.iteritems():
|
||||||
for what in data['labels']:
|
for what in (data['labels'] if data['labels'] is not None else []):
|
||||||
dim = table.label_dimension(what)
|
dim = table.label_dimension(what)
|
||||||
if dim != data['dim']: remarks.append('column {} is not a {}.'.format(what,type))
|
if dim != data['dim']: remarks.append('column {} is not a {}.'.format(what,type))
|
||||||
else:
|
else:
|
||||||
|
@ -157,4 +158,3 @@ for name in filenames:
|
||||||
# ------------------------------------------ output finalization -----------------------------------
|
# ------------------------------------------ output finalization -----------------------------------
|
||||||
|
|
||||||
table.close() # close input ASCII table (works for stdin)
|
table.close() # close input ASCII table (works for stdin)
|
||||||
if name != 'STDIN': os.rename(name+'_tmp',name) # overwrite old one with tmp new
|
|
||||||
|
|
Loading…
Reference in New Issue