from os import listdir, system from subprocess import call from ntpath import basename input_dir = 'input' output_dir = 'output' processing_app = 'texgloc.exe' def processing_args(input_file_path): def output_file_path(input_file_path): return output_dir + "\\" + input_file_path ainput = input_dir + "\\" + input_file_path aoutput = output_file_path(input_file_path) #aprec = "3" #3/5/7 #ascale = "2" #aalpha = "1" # <= 3.f #abeta = "20" # <= 255 aargs = [ainput, aoutput]#, aprec, ascale, aalpha, abeta] result = " ".join(aargs) print("args: " + result) return result def call_variations(ipath): ainput = input_dir + "/" + ipath aoutput = output_dir + "/" + ipath for prec in [3, 5, 7]: for scale in [1, 1.8, 2.6, 3.4]: for alpha in [0.2, 1.2, 2.2, 3.0]: for beta in range(20, 255, 80): iterators_str_list = list(map(str, [prec, scale, alpha, beta])) aoutput = output_dir + "/" + "-".join(iterators_str_list) + "-" + ipath process([ainput, aoutput] + iterators_str_list) def process(aargs): procedure = processing_app + " " + " ".join(aargs) print(procedure) system(procedure) input_files = listdir(input_dir) [call_variations(ipath) for ipath in input_files]