Skip to content

Commit ea2a748

Browse files
committed
fixing CSV exporter
1 parent b500e70 commit ea2a748

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

mathics/autoload/formats/CSV/Export.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
FunctionChannels -> {"Streams"},
2323
Options -> {"ByteOrderMark"},
2424
DefaultElement -> "Plaintext",
25-
BinaryFormat -> True,
25+
BinaryFormat -> False,
2626
Options -> {
2727
"CharacterEncoding",
2828
"FieldSeparators"

mathics/builtin/files.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import requests
2121
import pathlib
2222

23+
from io import BytesIO, StringIO
2324
import os.path as osp
2425
from itertools import chain
2526

@@ -1959,8 +1960,10 @@ def apply(self, channel, expr, evaluation):
19591960
Expression("FullForm", result).evaluate(evaluation),
19601961
)
19611962
exprs.append(result)
1962-
1963-
stream.write("".join(exprs))
1963+
line = "".join(exprs)
1964+
if type(stream) is BytesIO:
1965+
line = line.encode('utf8')
1966+
stream.write(line)
19641967
try:
19651968
stream.flush()
19661969
except IOError as err:

mathics/builtin/lists.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class ByteArray(Builtin):
188188
</dl>
189189
190190
>> A=ByteArray[{1,25,3}]
191-
= ByteArray["AQID"]
191+
= ByteArray["ARkD"]
192192
>> A[[2]]
193193
= 25
194194
>> B=ByteArray["asy"]

0 commit comments

Comments
 (0)