Eel icon indicating copy to clipboard operation
Eel copied to clipboard

Returing bytestring from Python to JS returns null

Open Patronics opened this issue 1 year ago • 0 comments

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

  • OS: Linux Debian
  • Browser: Chromium 120.0.6099.102-rpt1 arm64
  • Python Distribution: Python 3.11.2

Screenshots N/A

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

Patronics avatar Jan 26 '24 04:01 Patronics