I have a program script.out which I need to run against 10 files and redirect their output to 10 files. I am using subprocess.Popen() for this work but it seems to catch some error when redirecting stdout stream.
... for i in range(10): data = subprocess.Popen([ script.out, "<", input_file[i], ">", output_file[i]]) For the workaround, I use os.system() to run directly. But I want to know why the subprocess.Popen() process failed there?
terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc terminate called after throwing an instance of 'std::length_error' what(): cannot create std::vector larger than max_size()and I don't catch any error while running that command from shell manually. The script.out file is working finewith open(some_file_path, "w") as file_handle: file_handle.write(some_data)