Python Forum

Full Version: AttributeError: module 'asyncio' has no attribute 'get_event_loop
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all

I am trying to use Python asyncio module.
Adding my code snippet below :

import asyncio

async def speak_async():  
    print('OMG asynchronicity!')

loop = asyncio.get_event_loop()  
loop.run_until_complete(speak_async())  
loop.close() 


Am getting the following error while executing the script : "AttributeError: module 'asyncio' has no attribute 'get_event_loop'".
Am using Python 3.5.
Please share you valuable suggestion to solve the issue.


Regards
Susmitha
I can't reproduce the error.
OS, Python version? More details, please
make sure your file (or another one in the same folder) is not named asyncio.py
Hi Buran & wavic,

Thanks for your reply.
I named the file as asyncio.py ,i renamed the file and its working.

Thanks
Susmitha
I always forget about this common mistake  Big Grin
(Apr-24-2017, 09:54 AM)buran Wrote: [ -> ]make sure your file (or another one in the same folder) is not named asyncio.py
thanks a lot