Kotlin / kotlin-jupyter

Kotlin kernel for Jupyter/IPython
Apache License 2.0
1.11k stars 107 forks source link

MIME does not allow binary data #293

Closed mwisnicki closed 3 years ago

mwisnicki commented 3 years ago

README says:

fun MIME(vararg mimeToData: Pair<String, Any>): MimeTypedResult 

which had me hoping I can pass binary data for non-text formats but the actual signature is:

fun MIME(vararg mimeToData: Pair<String, String>): MimeTypedResult

Passing PNG as ISO-8859-1 encoded String didn't work too.

ileasile commented 3 years ago

We follow messaging protocol, and using this low-level API is in strict correlation with its documentation: https://jupyter-client.readthedocs.io/en/stable/messaging.html#display-data

The fact that you have no visible result in browser is because jupyter-notebook client does not support image/png MIME type. You still can render images using text/html or use corresponding convenience methods