Skip to content

object str can't be used in 'await' expression in PyScript Async Functions #673

Closed
@anpe03

Description

@anpe03

I am encountering a persistent error in PyScript when trying to perform an asynchronous HTTP request using aiohttp. Despite adhering to the asyncio guidelines and leveraging Home Assistant’s async_get_clientsession, the following error occurs consistently. This error arises regardless of the specific HTTP client method (response.text(), response.json(), or others), suggesting a deeper issue with how PyScript interprets awaitable objects.
1. The same code works flawlessly in a standalone Python environment.
2. Using task.executor to offload synchronous requests calls also fails due to PyScript restrictions.
3. The issue persists across various attempts to simplify the logic.

The issue seems to stem from PyScript misinterpreting certain objects (e.g., str or dict) as awaitable. This is not typical behavior for asyncio or aiohttp and may indicate a PyScript-specific bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions