from pathlib import Path import subprocess,sys p=Path(__file__).resolve().parent block=sys.argv[1] if len(sys.argv)>1 else '65536' name='histograms31.txt' if block=='65536' else 'reproduced31.txt' with (p/name).open('wb') as out: subprocess.run([str(p/'stream_counts'),'31',block],cwd=p,stdout=out,check=True,timeout=900) print('Completed',name,flush=True)