Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python urllib2 Errors

I have a long list of URLs I need to open for my service. Whenever I attempt to open this entire list, I receive many errors such as this when I initiate the program: [Errno 24] Too many open files. I am using urllib2 and gevent.

Does anyone have any solutions?

Thanks.

like image 586
Austin K Avatar asked Nov 04 '22 19:11

Austin K


1 Answers

Use Gevent.pool to only open a certain amount of urls at a time then reuse those greenlets when thay have opened a url.

like image 82
Justin Fay Avatar answered Nov 15 '22 06:11

Justin Fay