Running a Subprocess from Python and Capturing the Output and Errors
03 Apr 2019This post is more of a "scratchpad" post than anything else. I wanted to try a different method of running racket code that did not include docker. After some experimenting, I came up with the following Python code:
import subprocess
output = subprocess.run(["racket", "a6q1_solution.rkt"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print(output.stdout)
print(output.stderr)
Everything in Python is quick and easy. It is unclear which method I will be utilizing to run the code but this certainly looks clean and simple.