# HG changeset patch # User Joseph Turian # Date 1215125312 14400 # Node ID a04ce1e6ea540067176e99206818e340eda01d4c # Parent 417355f152828f0dd982433e19ee63ff0e04e2be Bugfix in common.misc.find_files diff -r 417355f15282 -r a04ce1e6ea54 common/file.py --- a/common/file.py Thu Jul 03 17:52:26 2008 -0400 +++ b/common/file.py Thu Jul 03 18:48:32 2008 -0400 @@ -1,4 +1,5 @@ import gzip, bz2 +import os, os.path, sys def myopen(filename, mode="r", bufsize=-1): """ @@ -16,15 +17,16 @@ Find all files in dir by recursively directory walking. @param shuffle: Randomly shuffle the files before returning them. """ - files = [] + all = [] + assert os.path.isdir(dir) for root, dirs, files in os.walk(dir): #sys.stderr.write("Walking %s...\n" % root) for f in files: - files.append(os.path.join(root, f)) + all.append(os.path.join(root, f)) if shuffle: import random - random.shuffle(files) - return files + random.shuffle(all) + return all def ensuredir(dir): """