Skip to Content
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 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
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.