diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2019-10-06 15:40:46 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2019-10-06 15:40:46 +0100 |
commit | d1c2e52b16f5148eb1ec1c833774d2afd5937bbe (patch) | |
tree | 546d0a6fa085987f53e0018e7c053bae0c2ef5f8 | |
parent | 3971c0347489012a5c58e332f5f6525ab052c5d8 (diff) |
small tweaks with logging and version bump to match bcompiler-engine
-rw-r--r-- | datamaps/__init__.py | 2 | ||||
-rw-r--r-- | datamaps/main.py | 18 |
2 files changed, 10 insertions, 10 deletions
diff --git a/datamaps/__init__.py b/datamaps/__init__.py index c9bd737..77eaf59 100644 --- a/datamaps/__init__.py +++ b/datamaps/__init__.py @@ -1 +1 @@ -__version__ = "1.0.0b0" +__version__ = "1.0.0b9" diff --git a/datamaps/main.py b/datamaps/main.py index cce33c7..0cc4218 100644 --- a/datamaps/main.py +++ b/datamaps/main.py @@ -26,10 +26,13 @@ from click import version_option from datamaps import __version__ from engine.adapters import cli as engine_cli from engine.config import Config as engine_config -from engine.use_cases.parsing import MalFormedCSVHeaderException +from engine.exceptions import (MalFormedCSVHeaderException, + RemoveFileWithNoSheetRequiredByDatamap) +logging.basicConfig(level=logging.INFO, format="%(asctime)s: %(levelname)s - %(message)s", datefmt='%d-%b-%y %H:%M:%S') logger = logging.getLogger(__name__) -logger.setLevel(logging.INFO) + + be_logger = logging.getLogger("engine.use_cases.parsing") @@ -91,19 +94,16 @@ def report(): def templates(to_master): # TODO move this to cli() engine_config.initialise() - click.secho("Hello from datamaps 1.0!", fg="yellow") + click.secho(f"Hello from datamaps {__version__}", fg="yellow") if to_master: try: engine_cli.import_and_create_master(echo_funcs=output_funcs) except MalFormedCSVHeaderException as e: click.echo( click.style("Incorrect headers in datamap. {}.".format(e.args[0]), bold=True, reverse=True, fg="cyan")) - except KeyError as e: - if "Expected Sheet Missing" in e.args: - click.echo("Expected Sheet Missing: sheet Introduction in test_template.xlsm is expected from" - " datamap.csv. Not processing that file until fixed." - "Imported data from input/dft1_temp.xlsm to output/master.xlsx." - "Finished.") + except RemoveFileWithNoSheetRequiredByDatamap: + logging.info("Import complete.") + else: click.secho("Not implemented yet. Try --to-master/-m flag") |