Skip to content

Commit d577b78

Browse files
committed
ExportString Base64
1 parent 05e4dc9 commit d577b78

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

mathics/builtin/importexport.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@
1313
Symbol,
1414
SymbolFailed,
1515
)
16-
from mathics.builtin.base import Builtin, Predefined, String, Integer, get_option
16+
from mathics.builtin.base import (
17+
Builtin,
18+
ByteArrayAtom,
19+
Predefined,
20+
String,
21+
Integer,
22+
get_option,
23+
)
1724

1825
from .pymimesniffer import magic
1926
import mimetypes
@@ -2218,8 +2225,11 @@ class B64Encode(Builtin):
22182225

22192226
def apply(self, expr, evaluation):
22202227
"System`Convert`B64Dump`B64Encode[expr_]"
2228+
print(expr)
22212229
if isinstance(expr, String):
22222230
stringtocodify = expr.get_string_value()
2231+
elif expr.get_head_name() == "System`ByteArray":
2232+
return String(expr._leaves[0].__str__())
22232233
else:
22242234
stringtocodify = (
22252235
Expression("ToString", expr).evaluate(evaluation).get_string_value()

0 commit comments

Comments
 (0)