summaryrefslogtreecommitdiff
path: root/gerbonara/ipc356.py
diff options
context:
space:
mode:
authorjaseg <git-bigdata-wsl-arch@jaseg.de>2022-06-18 23:51:43 +0200
committerjaseg <git-bigdata-wsl-arch@jaseg.de>2022-06-18 23:51:43 +0200
commita88364b7a98b6f8d8edd4f1616908ba8889485dd (patch)
tree1275cbfcda36aed6ab6e95c69fed710bf389a0b3 /gerbonara/ipc356.py
parentfa7a526883bdd35aca780b653af96169fd843aa8 (diff)
downloadgerbonara-a88364b7a98b6f8d8edd4f1616908ba8889485dd.tar.gz
gerbonara-a88364b7a98b6f8d8edd4f1616908ba8889485dd.tar.bz2
gerbonara-a88364b7a98b6f8d8edd4f1616908ba8889485dd.zip
Fix up saving and zip writing logic
Diffstat (limited to 'gerbonara/ipc356.py')
-rw-r--r--gerbonara/ipc356.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/gerbonara/ipc356.py b/gerbonara/ipc356.py
index ae341be..06a87f0 100644
--- a/gerbonara/ipc356.py
+++ b/gerbonara/ipc356.py
@@ -120,15 +120,15 @@ class Netlist(CamFile):
return parser.parse(data, Path(filename))
def save(self, filename, settings=None, drop_comments=True):
- with open(filename, 'w', encoding='utf-8') as f:
- f.write(self.to_ipc356(settings, drop_comments=drop_comments))
+ with open(filename, 'wb') as f:
+ f.write(self.write_to_bytes(settings, drop_comments=drop_comments))
- def to_ipc356(self, settings=None, drop_comments=True, job_name=None):
+ def write_to_bytes(self, settings=None, drop_comments=True, job_name=None):
if settings is None:
settings = self.import_settings.copy() or FileSettings()
settings.zeros = None
settings.number_format = (5,6)
- return '\n'.join(self._generate_lines(settings, drop_comments=drop_comments))
+ return '\n'.join(self._generate_lines(settings, drop_comments=drop_comments)).encode('utf-8')
def _generate_lines(self, settings, drop_comments, job_name=None):
yield 'C IPC-D-356 generated by Gerbonara'