bool('False') is True
bool() on a string only checks whether it is empty. Every non-empty string, including "False", "0" and "no", is True.
PythonType errors
What it means
Truthiness is about emptiness, not meaning: "" is falsy and any other string is truthy. Config files, environment variables, query strings and form fields all deliver text, so a setting written as false is still on.
Common causes
1. Parsing a config value with bool()
The word is never read.
Breaks
debug = bool(os.environ["DEBUG"]) # "false" -> TrueWorks
debug = os.environ["DEBUG"].strip().lower() in ("1", "true", "yes")2. Checking a form checkbox value
Unchecked boxes often send "off" or "0".
Breaks
if form["subscribe"]:Works
if form.get("subscribe") == "on":How to find it in your own code
Normalise the text (strip, lower) and compare against the exact words you accept. Treat anything unexpected as an error rather than silently true.
Still not sure why yours breaks?
Paste it into the visualizer and watch it run line by line, with every variable at every step. Free, and it runs in your browser.
Other common errors
TypeError: '>' not supported between instances of 'str' and 'int'TypeError: list indices must be integers or slices, not floatTypeError: can only concatenate str (not "int") to strValueError: invalid literal for int() with base 10TypeError: unhashable type: 'list'AttributeError: 'str' object has no attributeTypeError: object of type 'int' has no len()TypeError: sequence item 0: expected str instance, int found