Skip to content

Commit 250870c

Browse files
committed
[ModelicaSystem] do not use package csv
background: if OMCPath will be used, it is not available
1 parent abcae09 commit 250870c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

OMPython/ModelicaSystem.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"""
3434

3535
import ast
36-
import csv
3736
from dataclasses import dataclass
3837
import logging
3938
import numbers
@@ -1421,9 +1420,10 @@ def _createCSVData(self, csvfile: Optional[pathlib.Path] = None) -> pathlib.Path
14211420
if csvfile is None:
14221421
csvfile = self._tempdir / f'{self._model_name}.csv'
14231422

1424-
with open(file=csvfile, mode="w", encoding="utf-8", newline="") as fh:
1425-
writer = csv.writer(fh)
1426-
writer.writerows(csv_rows)
1423+
# basic definition of a CSV file using csv_rows as input
1424+
csv_content = "\n".join([",".join(map(str, row)) for row in csv_rows]) + "\n"
1425+
1426+
csvfile.write_text(csv_content)
14271427

14281428
return csvfile
14291429

0 commit comments

Comments
 (0)