def safe_store_h(path, o): print 'storing hkl:' + path directory = path[:path.rfind('/')] if not os.path.exists(directory): os.makedirs(directory) with open(path, "w") as f: hkl.dump(o, f) f.close()
def safe_store_c(path, o): print 'storing: ' + path directory = path[:path.rfind('/')] if not os.path.exists(directory): os.makedirs(directory) with open(path, "wb") as f: cPickle.dump(o, f) f.close()