Screenplay Checker#
Pull in
snippets/students.py. Goal is to compute from those names (containing umlauts) the directory names.iterate (tuple unpacking) over the tuples in the list.
str.replace()umlauts, upper and lower.observe code duplication.
⟶ function
transform()
Once transformed …
Take from the commmandline (
sys.argv[1]) the repository rootCompute the path to each user’s supposed
digitprogram.First, using dumb string additions and
/Replace with
os.path.join()(⟶ look it up in the docs)Check existence using
os.path.isfile()Raise
RuntimeErrorif not there
Whole program stops on first failure ⟶ collect errors and move on to next user
⟶
except, gathering errors in a listoutput pass/fail once all users iterated
Run prog
In the shell, run one prog. Show what “capture stdout” means, by redirecting to a file.
.../digit 7 | cat > file: aha, pipe to somewhere, and use that instead.Enter
subprocess. Read docs.Find that most progs are not executable. Catch that.
Raise
RuntimeErrorinsideexceptblock.
Find that
completed.stdoutisbytes. OMG, explain encoding. Notebook.
Module
studentsRaw user list
Function to convert to exercise dirs.
What else?