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.

0 likes
Debugging With console.log Without Drowning in Output Level: Beginner

console.log is the fastest way to see what your code is doing, until it prints 300 lines and you can't find the one that matters. Label your logs, log objects properly, use console.table and console.group, and clean up before you ship.

0 likes
Reading "Uncaught TypeError" Without Panicking Level: Beginner

"Uncaught TypeError: Cannot read properties of undefined" means you used a value that wasn't there. Read the message, find the line, check what is actually undefined, then fix the cause instead of hiding it.

0 likes
Custom Error Classes You Can Actually Catch Level: Intermediate

Stop checking error messages with includes(). Extend Error, set name, add the fields the handler needs, catch with instanceof, and wrap low-level errors with cause so the real reason isn't lost.

0 likes
Why Your Date Is Off by One Day Level: Intermediate

Your date moves a day because one part of the code uses UTC and another uses local time. Find which step does it, keep calendar days as YYYY-MM-DD strings, and name the time zone when you format.

0 likes
Fix "Cannot use import statement outside a module" Level: Intermediate

The file was loaded as a classic script or CommonJS, where import isn't allowed. The fix in the browser is type="module". In Node it's "type": "module" or .mjs, and recent npm init writes "type": "commonjs" for you.