diff --git a/honeybee_idaice/cli/translate.py b/honeybee_idaice/cli/translate.py index 5918a1b..b3f79db 100644 --- a/honeybee_idaice/cli/translate.py +++ b/honeybee_idaice/cli/translate.py @@ -4,6 +4,7 @@ import os import pathlib import logging +import base64 import tempfile import uuid @@ -104,7 +105,9 @@ def model_to_idm( if output_file.name == '': # 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)