Skip to content

Commit

Permalink
Add logging to help users with encoding issues
Browse files Browse the repository at this point in the history
We still haven't been able to get ontop of encoding issues in this app.
Most seem to happen when piping from stdout for which I am not clear
on the reasons. The logging information in this script may provide a
helpful prompt but a more permanent solution would be good.
  • Loading branch information
ross-spencer committed Sep 10, 2023
1 parent 9639278 commit 013aae5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/demystify/demystify.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@ def get_denylist_template() -> str:

def main():
"""Primary entry point for Demystify from the command line."""
encoding = sys.stdout.encoding
logging.info(f"Console encoding: {encoding}")
if encoding != "utf-8":
logging.warning(f"Encoding '{encoding}' may result in the script failing")
logging.warning(
"Please try `set PYTHONIOENCODING=utf-8` (Windows) `export PYTHONIOENCODING=utf-8` (Linux)"
)

parser = argparse.ArgumentParser(
description="Analyse DROID and Siegfried results stored in a SQLite database"
)
Expand Down

0 comments on commit 013aae5

Please sign in to comment.