asyncip application hangs

Yaşar Arabacı yasar11732 at
Tue Jul 22 00:34:57 CEST 2014

2014-07-22 1:19 GMT+03:00 Yaşar Arabacı <yasar11732 at>:
> This program is supposed to give me status codes for web pages that
> are found on my sitemap.xml file. But program hangs as Tasks wait for
> getting something out of the Queue. I think it has something to do
> with how I am using asyncio.Queue, but I couldn't figure out what am I
> doing wrong here. Can anyone help me with that?

Ok, I figured out what was wrong with my code.

Since asyncio.Queue.put() is a coroutine, I should have wrapped those
with asyncio.Task in order for them to start executing.

Therefore, this works;

    q = asyncio.Queue()
    loop = asyncio.get_event_loop()

    for i in range(num_coroutines):  # start 10 tasks

    for loc in soup.find_all('loc'):

    for i in range(num_coroutines):  # Put poison pil.

    print("%i items in queue" % q.qsize())



More information about the Python-list mailing list