def load_args(d): '''Load arguments from files in a temporary directory returns a tuple of arguments ''' files = os.listdir(d) fdict = dict() for fa in files: fn = _path.join(d, fa) if fn.endswith('.pkl'): try: f = open(fn, 'r') fdict[fa] = _pload(f) except: print finally: f.close() else: fdict[fa] = _aload(fn)[0] return _recreate_args(fdict['tree.pkl'], fdict)
def load_args(d): '''Load arguments from files in a temporary directory returns a tuple of arguments ''' files = os.listdir(d) fdict = dict() for fa in files: fn = _path.join(d, fa) if fn.endswith('.pkl'): try: f = open(fn, 'r') fdict[fa] = _pload(f) except : print finally: f.close() else: fdict[fa] = _aload(fn)[0] return _recreate_args(fdict['tree.pkl'], fdict)
def load_args(d): '''Load arguments from files in a temporary directory returns a tuple of arguments ''' files = os.listdir(d) fdict = dict() for fa in files: fn = _path.join(d, fa) if fn.endswith('.pkl'): try: f = open(fn, 'r') fdict[fa] = _pload(f) except : sys.stderr.write('Could not \n') finally: f.close() else: from scisoftpy.io import load as _aload fdict[fa] = _aload(fn)[0] return _recreate_args(fdict['tree.pkl'], fdict)
def load_args(d): '''Load arguments from files in a temporary directory returns a tuple of arguments ''' files = os.listdir(d) fdict = dict() for fa in files: fn = _path.join(d, fa) if fn.endswith('.pkl'): try: f = open(fn, 'rb') fdict[fa] = _pload(f) except: sys.stderr.write('Could not load %s\n' % fa) import traceback traceback.print_exc() finally: f.close() else: from scisoftpy.io import load as _aload nd = _aload(fn) fdict[fa] = nd if isinstance(nd, ndarray) else nd[0] return _recreate_args(fdict['tree.pkl'], fdict)