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

Getting "coroutine was expected" error while running example #13

Open
danaki opened this issue Oct 22, 2020 · 2 comments
Open

Getting "coroutine was expected" error while running example #13

danaki opened this issue Oct 22, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@danaki
Copy link

danaki commented Oct 22, 2020

Like so:

Traceback (most recent call last):
  File "discover.py", line 18, in <module>
    asyncio.run(asyncio.gather(read_and_print(aioserial_instance), aioserial_instance.write_async(b'Hello, World!\n')))
  File "/Users/up/anaconda3/envs/winch/lib/python3.8/asyncio/runners.py", line 37, in run
    raise ValueError("a coroutine was expected, got {!r}".format(main))
ValueError: a coroutine was expected, got <_GatheringFuture pending>

Python 3.8

@eling22
Copy link

eling22 commented Oct 27, 2020

you can turn:
asyncio.run(asyncio.gather(read_and_print(aioserial_instance), aioserial_instance.write_async(b'Hello, World!\n')))
to

async def tasks(aioserial_instance: aioserial.AioSerial):
    await asyncio.gather(read_and_print(aioserial_instance), aioserial_instance.write_async(b'Hello, World!\n'))

asyncio.run(tasks(aioserial_instance))

@Yuirii
Copy link

Yuirii commented Dec 25, 2020

@eling22 Thanks!

@mrjohannchang mrjohannchang added the enhancement New feature or request label Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants