Skip to content

Commit 3eb41d7

Browse files
committed
Handle strings
1 parent 4e022e3 commit 3eb41d7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

pyscriptjs/src/interpreter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ def format_mime(obj):
6868
"""
6969
Formats object using _repr_x_ methods.
7070
"""
71+
if isinstance(obj, str):
72+
return obj, 'text/plain'
7173
7274
mimebundle = eval_formatter(obj, '_repr_mimebundle_')
7375
if isinstance(mimebundle, tuple):

pyscriptjs/src/pyscript.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def format_mime(obj):
5959
"""
6060
Formats object using _repr_x_ methods.
6161
"""
62+
if isinstance(obj, str):
63+
return obj, 'text/plain'
6264

6365
mimebundle = eval_formatter(obj, '_repr_mimebundle_')
6466
if isinstance(mimebundle, tuple):

0 commit comments

Comments
 (0)