FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Improvements to logging output for config file issues by zooba · Pull Request #156 · python/pymanager · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
7 changes: 5 additions & 2 deletions src/manage/config.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ def load_config(root, override_file, schema):


def load_one_config(cfg, file, schema, *, overwrite=False):
LOGGER.verbose("Loading configuration from %s", file)
try:
with open(file, "r", encoding="utf-8-sig") as f:
LOGGER.verbose("Loading configuration from %s", file)
cfg2 = json.load(f)
except FileNotFoundError:
LOGGER.verbose("Skipping configuration at %s because it does not exist", file)
return
except OSError as ex:
LOGGER.warn("Failed to read %s: %s", file, ex)
LOGGER.warn("Failed to read configuration from %s: %s", file, ex)
LOGGER.debug("TRACEBACK:", exc_info=True)
return
except ValueError as ex:
Expand Down Expand Up @@ -159,6 +159,9 @@ def _sub(m):

def resolve_config(cfg, source, relative_to, key_so_far="", schema=None, error_unknown=False):
for k, v in list(cfg.items()):
if k.startswith("#"):
continue

try:
subschema = schema[k]
except LookupError:
Expand Down

Back | FazBrowse Home | New Git URL