Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ryannowarm opened this issue Sep 13, 2019 · 0 comments
Open

Comments

@ryannowarm
Copy link

ryannowarm commented Sep 13, 2019

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:~$ 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant