I'm trying to run the example below on IDLE (Python 3.43, Windows 7, 64bit) for days, but it always gives an error. I tried searching for the solution on the English version website, on google, and I did not find an answer. I can run on Anaconda, but IDLE does not work. The asyncio module is already installed. I'll put the code and then the error:
import asyncio
def print_and_repeat(loop):
print('Hello World')
loop.call_later(2, print_and_repeat, loop)
loop = asyncio.get_event_loop()
loop.call_soon(print_and_repeat, loop)
loop.run_forever()
Error:
Traceback (most recent call last):
File "C:\Users\Gustavo\Desktop\asyncio.py", line 1, in <module>
import asyncio File "C:\Users\Gustavo\Desktop\asyncio.py", line 7, in <module>
loop = asyncio.get_event_loop() AttributeError: 'module' object has no attribute 'get_event_loop'