Skip to content

Commit

Permalink
Merge pull request #20 from justbuchanan/gltf
Browse files Browse the repository at this point in the history
handle bytes and bytearray codec outputs in cq-cli.py
  • Loading branch information
jmwright authored Oct 22, 2023
2 parents fdf8a94 + 0e12099 commit 6ebb317
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cq-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,14 @@ def main():
if outfile == None:
print(converted)
else:
with open(outfile, 'w') as file:
file.write(converted)
if isinstance(converted, str):
with open(outfile, 'w') as file:
file.write(converted)
elif isinstance(converted, (bytes, bytearray)):
with open(outfile, 'wb') as file:
file.write(converted)
else:
raise TypeError("Expected converted output to be str, bytes, or bytearray. Got '%s'" % type(converted).__name__)

except Exception:
out_tb = traceback.format_exc()
Expand Down

0 comments on commit 6ebb317

Please sign in to comment.