def call_main_enqueue(stdout, stderr): backup_out = sys.stdout backup_err = sys.stderr f_out = open(stdout, "a") f_err = open(stderr, "a") sys.stdout = f_out sys.stderr = f_err sys.argv = [MAIN_NAME, "enqueue"] main() f_out.close() f_err.close() sys.stdout = backup_out sys.stderr = backup_err
def call_main_run_without_run(stdout, stderr): backup_out = sys.stdout backup_err = sys.stderr f_out = open(stdout, "a") f_err = open(stderr, "a") sys.stdout = f_out sys.stderr = f_err sys.argv = [MAIN_NAME, "undefined"] # assumes the user does not say run main() f_out.close() f_err.close() sys.stdout = backup_out sys.stderr = backup_err
def call_main_run_with_python_interpreter(stdout, stderr): backup_out = sys.stdout backup_err = sys.stderr f_out = open(stdout, "a") f_err = open(stderr, "a") sys.stdout = f_out sys.stderr = f_err sys.argv = [MAIN_NAME, "run", "--python_interpreter=python3"] main() f_out.close() f_err.close() sys.stdout = backup_out sys.stderr = backup_err
def call_main(main_py, stdout, stderr): backup_out = sys.stdout backup_err = sys.stderr f_out = open(stdout, "a") f_err = open(stderr, "a") sys.stdout = f_out sys.stderr = f_err sys.argv = [main_py + MAIN_NAME] main() f_out.close() f_err.close() sys.stdout = backup_out sys.stderr = backup_err
def call_main_enqueue(stdout, stderr): backup_out = sys.stdout backup_err = sys.stderr f_out = open(stdout, 'a') f_err = open(stderr, 'a') sys.stdout = f_out sys.stderr = f_err sys.argv = ['__main__.py', 'enqueue'] main() f_out.close() f_err.close() sys.stdout = backup_out sys.stderr = backup_err
def call_main(main_py, stdout, stderr): backup_out = sys.stdout backup_err = sys.stderr f_out = open(stdout, 'a') f_err = open(stderr, 'a') sys.stdout = f_out sys.stderr = f_err sys.argv = [main_py + '__main__.py'] main() f_out.close() f_err.close() sys.stdout = backup_out sys.stderr = backup_err