Skip to content

Commit

Permalink
Revert argparse output to uft-8 mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
fsimonis committed Apr 17, 2024
1 parent d4e79d2 commit 9b4aeec
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions preciceconfigvisualizer/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def parse_args():
"-o",
"--outfile",
nargs="?",
type=argparse.FileType("wb"),
type=argparse.FileType("w"),
default=sys.stdout,
help=f"The output file. Files with extensions {', '.join(SUPPORTED_FORMATS)} will be rendered using graphviz. Omit to output dot to stdout.",
)
Expand Down Expand Up @@ -86,7 +86,8 @@ def main():
g = pydot.graph_from_dot_data(dot)[0]
args.outfile.write(g.create(format=ext))
else:
args.outfile.write(dot.encode())
# sys.stdout is always in utf-8 mode, so we do the same for the outfile
args.outfile.write(dot)


if __name__ == "__main__":
Expand Down

0 comments on commit 9b4aeec

Please sign in to comment.