From b33df8561cffddf0e0fa24edcaee419923ee3422 Mon Sep 17 00:00:00 2001 From: Roman Parise Date: Sat, 11 Feb 2023 22:51:53 -0800 Subject: [PATCH] Fix Windows issue --- PySpice/Spice/OpenSPICE/OpenSPICE.py | 1 + PySpice/Spice/OpenSPICE/genout.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/PySpice/Spice/OpenSPICE/OpenSPICE.py b/PySpice/Spice/OpenSPICE/OpenSPICE.py index dda44a26..157a6cb0 100755 --- a/PySpice/Spice/OpenSPICE/OpenSPICE.py +++ b/PySpice/Spice/OpenSPICE/OpenSPICE.py @@ -8,6 +8,7 @@ def run(input_fname, output_fname): with open(input_fname, "r") as f: file_txt = f.read() + file_txt = file_txt.replace("\n\n", "\n") pdata = parse(file_txt) eqns = gen_eqns_top(pdata) # TODO Support multiple test types? diff --git a/PySpice/Spice/OpenSPICE/genout.py b/PySpice/Spice/OpenSPICE/genout.py index 32c9a0e1..3fd947ce 100644 --- a/PySpice/Spice/OpenSPICE/genout.py +++ b/PySpice/Spice/OpenSPICE/genout.py @@ -39,7 +39,7 @@ def gen_out_txt(raw_fname, title, test_type, soln, sorted_nodes): (test_type == "tran")+i,"V({})".format(v)) \ for i,v in enumerate(sorted_nodes)]) spice_raw_file_txt += "Binary:\n" - with open(raw_fname, "w") as spice_raw_file: - spice_raw_file.write(spice_raw_file_txt) + with open(raw_fname, "wb") as spice_raw_file: + spice_raw_file.write(bytes(spice_raw_file_txt, "UTF-8")) with open(raw_fname, "ab") as spice_raw_file: [spice_raw_file.write(array('d', s).tobytes()) for s in soln]