Skip to content

Commit

Permalink
fix(cli): Encode IDM file contents as base64 string
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed Jul 3, 2024
1 parent 9db6499 commit e2d34f6
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit e2d34f6

Please sign in to comment.