From a23088dbafc096efc790038fa043fe92a513f64f Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 28 Sep 2023 11:14:49 -0400 Subject: [PATCH] Do not rely on order of files of os.walk RNG is seeded but order could change from run to run causing irreproducible results --- launch_parser_on_nidm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/launch_parser_on_nidm.py b/launch_parser_on_nidm.py index 5981f889f..8596dbfc2 100755 --- a/launch_parser_on_nidm.py +++ b/launch_parser_on_nidm.py @@ -81,8 +81,8 @@ def main(): context_write.write("Processing files...\n") # Iteration on each example - for root, _, files in os.walk(opt.input_dir): - for file in files: + for root, _, files in sorted(os.walk(opt.input_dir)): + for file in sorted(files): if file.endswith("batch.m"): # spm filename_ss_ext = file.split(".m")[0]