fix issue 8

fix [issue 8](https://github.com/lixiang0/WEB_KG/issues/8),thanks to @cxjtju
This commit is contained in:
Ruben 2019-04-02 12:59:36 +08:00 committed by GitHub
parent 1a23fd6c95
commit 4c276e28e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,16 +38,15 @@ class MyThread(threading.Thread):
output.close()
def run(self):
try:
while(True):
if len(pages)>0:
lock.acquire()
page=pages[0]
pages.remove(page)
lock.release()
self.extract(page)
lock.acquire()
paged.append(page)
lock.release()
while len(pages)>0 and self.running:
lock.acquire()
page=pages[0]
pages.remove(page)
lock.release()
self.extract(page)
lock.acquire()
paged.append(page)
lock.release()
except Exception as e:
print('fail to extract..',str(e))
fail_file.write(page)