gevent + urllib2 blocking
yueyoum at gmail.com
Fri Feb 22 16:40:24 CET 2013
One problem, thanks for help.
from lxml import etree
# I using xpath parse the html
url = BUILD_URL(p)
html = urllib2.urlopen(url)
# RUN AT HERE AND BLOCKING
tree = etree.parse(html, parse)
# tree = etree.fromstring(html.read(), parse)
workers = [gevent.spawn(_get, i) for i in xrange(1, 100)]
When using ver1, etree.parse(html, parse)
I noticed there are only two greenlets runs at "RUN AT HERE AND BLOCKING"
others are not running!
But, when I using ver2, this code will running normally as expected.
Why this ?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list