Skip to content

'Future' object has no attribute 'then' #2923

@karray

Description

@karray

🐛 Bug

If I understand correctly, starting with version 0.17, Pyodide integrates the implementation of await for JsProxy. So when JS returns a Promise, it converts it to Future in Python, which allows us to use await.

Hoverer, the Future object has no attribute then, so it is no longer possible to build then/catch chains like in older versions.

To Reproduce

import js
js.fetch('http://karay.me/truepyxel/test.json').then(lambda resp: resp.json()).then(lambda data: data.msg).catch(lambda err: 'there were error: '+err.message)

Environment

  • Pyodide Version: 0.20
  • Browser version: 103.0.5060.134

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions