Skip to content

no time.sleep() ... how to call js async code from python runtime ? #97

@amigrave

Description

@amigrave

I noticed that time.sleep() is a no op in the pyodide's cpython webassembly runtime. As cpython implements it using select.select()'s timeout, it's not really a surprise that it's not supported by pyodide.

That said I have to call a javascript function from the python runtime and the js function will do asynchronous stuff before being able to return the value. eg:

from js import my_async_javascript_function

I first tried to do polling but without time.sleep() it's not doable.

How can I handle this properly with pyodide ? Through Promise ? async/await ? ... I could not find a clue for this, any hint would be appreciated.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions