Skip to content

TypeError: object AsyncWrapper can't be used in 'await' expression #367

@ryannowarm

Description

@ryannowarm

I'm getting the error above when running the await subscribe example.

(asyncwrapper_issue) ryanow01@U203622:~$ python3 --version
Python 3.7.3
(asyncwrapper_issue) ryanow01@U203622:~$ cat asyncwrapper_issue.py 
#!/usr/bin/env python3
import asyncio

from mbed_cloud import ConnectAPI
from mbed_cloud.subscribe.channels import DeviceStateChanges


async def main():
    connect_api = ConnectAPI()
    for my_future in connect_api.subscribe(DeviceStateChanges(device_id=None)):
        await my_future


if __name__ == '__main__':
    asyncio.run(main())
(asyncwrapper_issue) ryanow01@U203622:~$ python3 asyncwrapper_issue.py 
/home/ryanow01/sandboxes/mbed-cloud-sdk-python/src/mbed_cloud/connect/connect.py:97: FutureWarning: [Beta] this section of the SDK is at a `beta` release level and is subject to change without notice: <class 'mbed_cloud.subscribe.subscribe.SubscriptionsManager'>
  self.subscribe = SubscriptionsManager(self)
Traceback (most recent call last):
  File "asyncwrapper_issue.py", line 15, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "asyncwrapper_issue.py", line 11, in main
    await my_future
TypeError: object AsyncWrapper can't be used in 'await' expression
(asyncwrapper_issue) ryanow01@U203622:~$ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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