python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.5k stars 592 forks source link

Returing bytestring from Python to JS returns null #717

Open Patronics opened 10 months ago

Patronics commented 10 months ago

Eel version 0.16.0

Describe the bug returning a bytestring from python to Javascript just gives the value null, though decoding it to a utf-8 string works fine.

To Reproduce Steps to reproduce the behavior:

@eel.expose
def demo_py():
     return b"hello world"
async function demo_js():
    let str = await eel.demo_py()();
    console.log(str);

Expected behavior The bytestring is passed to the javascript function, either as a array of numbers, or a string, or some other reasonable implementation

System Information

Screenshots N/A

Additional context As a workaround, decoding the bytestring to a UTF8 string in python before returning behaves as expected.