Trying ro fix multi-threading issue
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import sys
|
||||
from urllib import request
|
||||
from urllib.error import HTTPError, URLError
|
||||
from bs4 import BeautifulSoup, Tag, ResultSet
|
||||
@@ -138,6 +139,7 @@ class WebPicDownloader():
|
||||
Stop the downloading and processing of images (method for use in a thread).
|
||||
"""
|
||||
self.thread_run = False
|
||||
sys.exit(0)
|
||||
|
||||
def download(self, url: str, folder_name: str) -> bool:
|
||||
"""
|
||||
@@ -158,8 +160,10 @@ class WebPicDownloader():
|
||||
self.messenger(f"WebPicDownloader found {len(images)} images on the website.")
|
||||
|
||||
for i, img in enumerate(images):
|
||||
print("check")
|
||||
print(id(self))
|
||||
if not self.thread_run:
|
||||
exit()
|
||||
print("return")
|
||||
try:
|
||||
self.messenger(f"Start downloading image {i}.")
|
||||
img_link = self.__find_img_link(img)
|
||||
|
||||
Reference in New Issue
Block a user