Skip to Content
0 likes
How to Read a Python Error Message Without Panicking Level: Beginner

A traceback is not the problem. It's the first clue. Four questions you ask every time, tried on real tracebacks that try to mislead you: errors in one file caused by another, errors deep inside Python's own code, two tracebacks in one message, and syntax errors that point to the wrong line.

0 likes
Python try/except: Catch the Error You Expect, Not Every Error Level: Beginner

A bare except hides typos and real bugs behind wrong results. Catch the specific error you expect, keep the try block small, and let everything else crash where you can see it.

0 likes
Fixing ModuleNotFoundError in Python, One Cause at a Time Level: Intermediate

ModuleNotFoundError has a handful of causes: the wrong Python, an inactive virtual environment, the wrong folder, or a file that shadows a module. Check them in order instead of reinstalling.

0 likes
Python Is Not Recognized? Fixing PATH on Windows, Mac and Linux Level: Beginner

Python is probably installed. Your terminal just can't find it. Check the three possible causes in order, fix the right one on Windows, Mac or Linux, and confirm which Python you're really running.

0 likes
Python logging: Replacing print() Before It Gets Out of Hand Level: Intermediate

print() is for the output a person asked for. logging is for messages about the program: levels you can turn down, a file with times, and tracebacks for errors. Set it up once in main() and use a logger per module.

0 likes
Adding mypy to an Existing Python Project Without 500 Errors on Day One Level: Advanced

Start mypy with its defaults, fix what it finds, turn on check_untyped_defs, then make one module at a time strict. Every function you annotate checks every place that calls it, so start with the busiest ones.

0 likes
Diagnose pytest Discovery and src-Layout Import Errors Level: Intermediate

Separate zero collected tests from an import failure, install into the correct environment, and prove the selected test catches a broken assertion.