You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DeprecationWarning: There is no current event loop loop = asyncio.get_event_loop() #6
Haha this is really old topic, but the message "There is no current event loop" means that the code is trying to use an event loop, but there is no event loop currently running or available.
You have to set the loop, as example like this:
def main():
event_filter = contract.events.PairCreated.createFilter(fromBlock='latest')
#block_filter = web3.eth.filter('latest')
# tx_filter = web3.eth.filter('pending')
loop = asyncio.new_event_loop()
#This will set the loop
asyncio.set_event_loop(loop)
try:
loop.run_until_complete(
asyncio.gather(
log_loop(event_filter,2 )))
# log_loop(block_filter, 2),
# log_loop(tx_filter, 2)))
finally:
# close loop to free up system resources
loop.close()
Activity
BOT-TI commentedon Jan 23, 2023
Haha this is really old topic, but the message "There is no current event loop" means that the code is trying to use an event loop, but there is no event loop currently running or available.
You have to set the loop, as example like this: