0

Here's my code:

async def random():
    return 1, 2
idk1, idk2 = random()
print(idk1, idk2)

After running, I received the error: cannot unpack non-iterable coroutine object. How can I fix this? Thank you!

raid6n
  • 55
  • 1
  • 7
  • 4
    It appears that your question really is "how do I use coroutines". Is your use of coroutines in your question intentional? – Brian61354270 Jan 26 '21 at 22:35
  • Does this answer your question? [How to call a async function from a synchronized code Python](https://stackoverflow.com/questions/51762227/how-to-call-a-async-function-from-a-synchronized-code-python) – kaya3 Mar 01 '21 at 03:08

1 Answers1

0

i used asyncio.run

import asyncio
async def random():
    return 1, 2
idk1, idk2 = asyncio.run(random())
print(idk1, idk2)
raid6n
  • 55
  • 1
  • 7