Two starter .py files in Labfiles/ do not compile as shipped. Learners who follow the exercise and run the file before adding their own code hit an IndentationError immediately.
Found while running py_compile across the whole Labfiles/ tree. Reporting only — not fixed here, since the work that surfaced it (#145) is deliberately additive and doesn't touch these labs.
Failures
Labfiles/05-speech-tool/Python/speech-client/speech-client.py
IndentationError: expected an indented block after 'else' statement on line 30 (line 35)
Labfiles/06-voice-live/Python/chat-client/chat-client.py
IndentationError: expected an indented block after 'try' statement on line 72 (line 89)
The other 7 starter files in Labfiles/ compile cleanly.
Cause
Both are the same pattern: a block opener whose body contains only comments, which is not valid Python.
speech-client.py — the else: contains just a comment placeholder:
if prompt == "quit" or len(prompt) == 0:
break
else:
# Use the agent to get a response
except Exception as ex:
chat-client.py — the try: contains only the five numbered STEP comments, with the code the learner is meant to add being what would give it a body.
Impact
The exercises tell learners to run the file at an intermediate stage. In 05 the instructions say to review the existing code and add the namespace imports before running; in 06 the scaffolding is presented as runnable. In both cases the file cannot be executed until the learner has added the missing block body, so anyone who runs it early — or who wants to confirm their environment works before editing — gets a syntax error rather than the intended behaviour.
Suggested fix
Give each empty block a body that is valid but obviously a placeholder, so the file compiles and runs while still leaving the exercise intact. Either:
- restructure so no empty block exists (e.g. in
speech-client.py, drop the else: and use continue after break), or
- add an explicit
pass with a comment telling the learner to remove it, e.g. pass # Remove this line once you have added the code for steps 1-5.
Worth adding python -m py_compile over Labfiles/**/*.py to CI to catch this class of problem, since it is invisible to review but immediate for a learner.
Repro
python -m py_compile Labfiles/05-speech-tool/Python/speech-client/speech-client.py
python -m py_compile Labfiles/06-voice-live/Python/chat-client/chat-client.py
Reproduced on Python 3.12 and 3.14.
Two starter
.pyfiles inLabfiles/do not compile as shipped. Learners who follow the exercise and run the file before adding their own code hit anIndentationErrorimmediately.Found while running
py_compileacross the wholeLabfiles/tree. Reporting only — not fixed here, since the work that surfaced it (#145) is deliberately additive and doesn't touch these labs.Failures
The other 7 starter files in
Labfiles/compile cleanly.Cause
Both are the same pattern: a block opener whose body contains only comments, which is not valid Python.
speech-client.py— theelse:contains just a comment placeholder:chat-client.py— thetry:contains only the five numbered STEP comments, with the code the learner is meant to add being what would give it a body.Impact
The exercises tell learners to run the file at an intermediate stage. In
05the instructions say to review the existing code and add the namespace imports before running; in06the scaffolding is presented as runnable. In both cases the file cannot be executed until the learner has added the missing block body, so anyone who runs it early — or who wants to confirm their environment works before editing — gets a syntax error rather than the intended behaviour.Suggested fix
Give each empty block a body that is valid but obviously a placeholder, so the file compiles and runs while still leaving the exercise intact. Either:
speech-client.py, drop theelse:and usecontinueafterbreak), orpasswith a comment telling the learner to remove it, e.g.pass # Remove this line once you have added the code for steps 1-5.Worth adding
python -m py_compileoverLabfiles/**/*.pyto CI to catch this class of problem, since it is invisible to review but immediate for a learner.Repro
Reproduced on Python 3.12 and 3.14.