Closed marc-odp closed 1 year ago
def main(): await email_simple_send() return None
I tried that but I get the error
await email_simple_send()
^
SyntaxError: 'await' outside async function
You need to make the "main" function async
async def main():
async def main():
await email_simple_send()
return None
if __name__ == "__main__":
main()
Gives : RuntimeWarning: coroutine 'main' was never awaited main()
And this
async def main():
await email_simple_send()
return None
if __name__ == "__main__":
await main()
Gives :
await main()
^
SyntaxError: 'await' outside function
So it seems that we are out of solution at this point. That doesn't seem right, is it ?
Can You please do it with this code:
import asyncio
if __name__ == "__main__":
asyncio.run(main())
I did it like this and it worked perfectly. Thank you for your help ! All the examples in the doc are "routes" examples. Maybe it would be good to add one example to show how to use the library this way too ?
def main():
asyncio.run(email_simple_send())
return None
if __name__ == "__main__":
main()
Hi, I created a function like this
How am I supposed to call it ? I tried this
But I get this error
Any idea ? Thanks.