As mentioned in the title. I have this in my code:
os.system("./vpr/vpr " + config + " " + file_name + " --seed " + str(seed) + " &> " + str(bench_name) + "-" + str(seed) + ".stdout")
Which has a lot of variables, but it simply evaluates to this (I know for sure because I have a print statement right before the os.system line):
./vpr/vpr vpr/k6_N10_40nm.xml vpr/blif/clma.blif --seed 0 &> clma-0.stdout
The command actually runs fine, but the redirection does not! The file clma-0.stdout gets created but remains empty, and I still get the entire stdout on my terminal.
What is the solution for that? What am I doing wrong? I'm using python-3.7 on Ubuntu 19.10
Thanks.
I think that's because you are trying to do it using system command, not Bash which supports these I/O redirection flags.
Try this one with shell=True https://docs.python.org/2/library/subprocess.html#subprocess.call
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With