Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): Encode IDM file contents as base64 string #37

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion honeybee_idaice/cli/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import pathlib
import logging
import base64
import tempfile
import uuid

Expand Down Expand Up @@ -104,7 +105,9 @@ def model_to_idm(
if output_file.name == '<stdout>': # load file contents to stdout
with open(idm_file, 'rb') as of: # IDM can only be read as binary
f_contents = of.read()
output_file.write(f_contents)
b = base64.b64encode(f_contents)
base64_string = b.decode('utf-8')
output_file.write(base64_string)
except Exception as e:
_logger.exception('Model translation failed.\n{}'.format(e))
sys.exit(1)
Expand Down
Loading