From 3a6a03805abeb8aa5ab080f79a94d65d02421c7f Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Thu, 6 Aug 2020 09:46:04 -0500 Subject: Update README example to remove MissingKeyError --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2b51ac0..96a27af 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,8 @@ for the package to recognize it and use the correct parser for it. ### Setting up ConfigFile -To use the package, we import in the `ConfigFile` object. +To use the package, we import in the `ConfigFile` object. This object +is the only thing considered to be part of the public API. We can set it up by giving it a string or `pathlib.Path` as the argument. Any home tildes `~` in the string or `Path` are recognized and converted @@ -132,11 +133,9 @@ There are two ways we could handle that. The first is the one we're used to seeing: catch the error. ```python -from config_file import MissingKeyError - try: important_value = config.get('section.i_do_not_exist') -except MissingKeyError: +except KeyError: important_value = 42 ``` -- cgit v1.2.3