yaojialyu / crawler Goto Github PK
View Code? Open in Web Editor NEWa web crawler
a web crawler
Showing me this error: File "main.py", line 1
I am using windows command line and pytho 3.x
我现在正在改造你的crawler算法抓取豆瓣的数据。先表示感谢!
我想问的是,ThreadPool中的resultQueue
的含义是什么?
我从代码中并没有读出来它的意义,可能是由于代码中的一个bug:
在ThreadPool.py中的第40行,func(*args, **kargs)
调用的是Crawler的_taskHandler
函数,而此函数是没有返回值的,所以导致result
的值永远为None
。
发现了threadPool.py中的一个bug:
比如在
def increaseRunsNum(self): self.lock.acquire() #锁住该变量,保证操作的原子性 self.running += 1 #正在运行的线程数加1 self.lock.release()
中,self.lock.acquire()
,如果self.lock
无法获取,即现在正在被人占用,Lock.acquire()
会返回False
,所以这里应该改为if self.lock.acquire()
,详见:http://docs.python.org/2/library/threading.html#lock-objects
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.