MCPcopy Create free account
hub / github.com/ShivaBhattacharjee/KeyZen / load_config

Function load_config

data/python/04_error_handling.py:3–12  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

1import json
2
3def load_config(path):
4 try:
5 with open(path, "r") as f:
6 return json.load(f)
7 except FileNotFoundError:
8 print(f"Config not found: {path}")
9 return {}
10 except json.JSONDecodeError as e:
11 print(f"Invalid JSON: {e}")
12 return {}
13
14def safe_divide(a, b):
15 if b == 0:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected