diff --git a/processing/post/permuteData.py b/processing/post/permuteData.py index 485f44dc9..0b5760066 100755 --- a/processing/post/permuteData.py +++ b/processing/post/permuteData.py @@ -38,13 +38,14 @@ if len(options.label) == 0: # --- loop over input files ------------------------------------------------------------------------- -if filenames == []: filenames = ['STDIN'] +if filenames == []: filenames = [None] for name in filenames: - if not (name == 'STDIN' or os.path.exists(name)): continue - table = damask.ASCIItable(name = name, outname = name+'_tmp', - buffered = False) - table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else '')) + try: + table = damask.ASCIItable(name = name, + buffered = False) + except: continue + table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) # ------------------------------------------ read header ------------------------------------------ @@ -94,4 +95,3 @@ for name in filenames: # ------------------------------------------ output finalization ----------------------------------- table.close() # close ASCII tables - if name != 'STDIN': os.rename(name+'_tmp',name) # overwrite old one with tmp new diff --git a/processing/post/reLabel.py b/processing/post/reLabel.py index 387a38b1e..ed8180a07 100755 --- a/processing/post/reLabel.py +++ b/processing/post/reLabel.py @@ -34,13 +34,14 @@ parser.set_defaults(label = [], # --- loop over input files ------------------------------------------------------------------------- -if filenames == []: filenames = ['STDIN'] +if filenames == []: filenames = [None] for name in filenames: - if not (name == 'STDIN' or os.path.exists(name)): continue - table = damask.ASCIItable(name = name, outname = name+'_tmp', - buffered = False) - table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else '')) + try: + table = damask.ASCIItable(name = name, + buffered = False) + except: continue + table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) # ------------------------------------------ read header ------------------------------------------ @@ -85,4 +86,3 @@ for name in filenames: # ------------------------------------------ output finalization ----------------------------------- table.close() # close ASCII tables - if name != 'STDIN': os.rename(name+'_tmp',name) # overwrite old one with tmp new diff --git a/processing/post/rotateData.py b/processing/post/rotateData.py index 947b1d9af..de56d331a 100755 --- a/processing/post/rotateData.py +++ b/processing/post/rotateData.py @@ -51,13 +51,14 @@ R = q.asMatrix() # --- loop over input files ------------------------------------------------------------------------- -if filenames == []: filenames = ['STDIN'] +if filenames == []: filenames = [None] for name in filenames: - if not (name == 'STDIN' or os.path.exists(name)): continue - table = damask.ASCIItable(name = name, outname = name+'_tmp', - buffered = False) - table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else '')) + try: + table = damask.ASCIItable(name = name, + buffered = False) + except: continue + table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) # ------------------------------------------ read header ------------------------------------------ @@ -115,4 +116,3 @@ for name in filenames: # ------------------------------------------ output finalization ----------------------------------- table.close() # close ASCII tables - if name != 'STDIN': os.rename(name+'_tmp',name) # overwrite old one with tmp new diff --git a/processing/post/scaleData.py b/processing/post/scaleData.py index 19aa10d3a..0d95c8819 100755 --- a/processing/post/scaleData.py +++ b/processing/post/scaleData.py @@ -38,13 +38,14 @@ if len(options.label) != len(options.factor): # --- loop over input files ------------------------------------------------------------------------- -if filenames == []: filenames = ['STDIN'] +if filenames == []: filenames = [None] for name in filenames: - if not (name == 'STDIN' or os.path.exists(name)): continue - table = damask.ASCIItable(name = name, outname = name+'_tmp', - buffered = False) - table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else '')) + try: + table = damask.ASCIItable(name = name, + buffered = False) + except: continue + table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) # ------------------------------------------ read header ------------------------------------------ @@ -86,4 +87,3 @@ for name in filenames: # ------------------------------------------ output finalization ----------------------------------- table.close() # close ASCII tables - if name != 'STDIN': os.rename(name+'_tmp',name) # overwrite old one with tmp new diff --git a/processing/post/shiftData.py b/processing/post/shiftData.py index 061334ef6..8a126dc30 100755 --- a/processing/post/shiftData.py +++ b/processing/post/shiftData.py @@ -38,13 +38,14 @@ if len(options.label) != len(options.delta): # --- loop over input files ------------------------------------------------------------------------- -if filenames == []: filenames = ['STDIN'] +if filenames == []: filenames = [None] for name in filenames: - if not (name == 'STDIN' or os.path.exists(name)): continue - table = damask.ASCIItable(name = name, outname = name+'_tmp', - buffered = False) - table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else '')) + try: + table = damask.ASCIItable(name = name, + buffered = False) + except: continue + table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) # ------------------------------------------ read header ------------------------------------------ @@ -86,4 +87,3 @@ for name in filenames: # ------------------------------------------ output finalization ----------------------------------- table.close() # close ASCII tables - if name != 'STDIN': os.rename(name+'_tmp',name) # overwrite old one with tmp new diff --git a/processing/post/showTable.py b/processing/post/showTable.py index bf5b2955d..2320eefba 100755 --- a/processing/post/showTable.py +++ b/processing/post/showTable.py @@ -59,13 +59,14 @@ parser.set_defaults(head = False, # --- loop over input files ------------------------------------------------------------------------- -if filenames == []: filenames = ['STDIN'] +if filenames == []: filenames = [None] for name in filenames: - if not (name == 'STDIN' or os.path.exists(name)): continue - table = damask.ASCIItable(name = name, outname = None, - buffered = False, labeled = options.labeled, readonly = True) - table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else '')) + try: + table = damask.ASCIItable(name = name, + buffered = False, labeled = options.labeled, readonly = True) + except: continue + table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) # ------------------------------------------ output head --------------------------------------- diff --git a/processing/post/sortTable.py b/processing/post/sortTable.py index 0915d5815..009d8d02b 100755 --- a/processing/post/sortTable.py +++ b/processing/post/sortTable.py @@ -43,13 +43,14 @@ options.keys.reverse() # --- loop over input files ------------------------------------------------------------------------- -if filenames == []: filenames = ['STDIN'] +if filenames == []: filenames = [None] for name in filenames: - if not (name == 'STDIN' or os.path.exists(name)): continue - table = damask.ASCIItable(name = name, outname = name+'_tmp', - buffered = False) - table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name != 'STDIN' else '')) + try: + table = damask.ASCIItable(name = name, + buffered = False) + except: continue + table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) # ------------------------------------------ assemble header --------------------------------------- @@ -77,5 +78,3 @@ for name in filenames: table.data = table.data[ind] table.data_writeArray() table.close() # close ASCII table - - if name != 'STDIN': os.rename(name+'_tmp',name) # overwrite old one with tmp new