diff --git a/conservancy_beancount/reconcile/statement_reconciler.py b/conservancy_beancount/reconcile/statement_reconciler.py index 87865cc..904f101 100644 --- a/conservancy_beancount/reconcile/statement_reconciler.py +++ b/conservancy_beancount/reconcile/statement_reconciler.py @@ -702,9 +702,10 @@ def parse_repo_relative_path(path: str) -> str: if not os.path.exists(path): raise argparse.ArgumentTypeError(f'File {path} does not exist.') real_path = os.path.realpath(path) - repo = os.path.realpath(os.getenv('CONSERVANCY_REPOSITORY')) - if not repo: - raise argparse.ArgumentTypeError('$CONSERVANCY_REPOSITORY is not set.') + try: + repo = os.path.realpath(os.environ['CONSERVANCY_REPOSITORY']) + except KeyError: + raise argparse.ArgumentTypeError('$CONSERVANCY_REPOSITORY environment variable is not set.') if not real_path.startswith(repo): raise argparse.ArgumentTypeError( f'File {real_path} does not share a common prefix with $CONSERVANCY_REPOSITORY {repo}.'