Skip to content

Commit

Permalink
fix: cp1252 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
carderne committed Dec 19, 2023
1 parent ca0e9a9 commit fa69cd3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions sigexport/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def fetch_data(
"""Load SQLite data into dicts."""
contacts: Contacts = {}
convos: Convos = {}
if chats:
chats_list = chats.split(",")
chats_list = chats.split(",") if chats else []

db_file_decrypted = db_file.parents[0] / "db-decrypt.sqlite"
if manual:
Expand Down
14 changes: 8 additions & 6 deletions sigexport/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,13 +540,8 @@ def main(
if verbose:
cmd.append("--verbose")
try:
p = subprocess.run(cmd, capture_output=True, text=True, check=True)
p = subprocess.run(cmd, capture_output=True, text=True, check=True, encoding="utf-8")
docker_logs_1, data_raw, docker_logs_2 = p.stdout.split(DATA_DELIM)
data = json.loads(data_raw)
if log:
secho(docker_logs_1)
secho(docker_logs_2)
convos, contacts = data["convos"], data["contacts"]
except FileNotFoundError:
secho("Error: using Docker method, but is Docker installed?", fg=colors.RED)
secho("Try running this from the command line:\ndocker run hello-world")
Expand All @@ -557,11 +552,18 @@ def main(
except subprocess.TimeoutExpired:
secho("Docker process timed out.")
raise Exit(1)
try:
data = json.loads(data_raw)
if log:
secho(docker_logs_1)
secho(docker_logs_2)
except json.JSONDecodeError:
secho("Unable to decode data from Docker, see logs below:", fg=colors.RED)
secho(p.stdout)
secho(p.stderr, fg=colors.RED)
raise Exit(1)
try:
convos, contacts = data["convos"], data["contacts"]
except (KeyError, TypeError):
secho(
"Unable to extract convos and contacts from Docker, see data below",
Expand Down

0 comments on commit fa69cd3

Please sign in to comment.