From bc55a35e4474d72eea9225eae2db8b47796bf46b Mon Sep 17 00:00:00 2001 From: break27 Date: Fri, 29 Aug 2025 12:13:34 +0800 Subject: [PATCH] minor fix --- main.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/main.py b/main.py index ac3c9c5..299a968 100644 --- a/main.py +++ b/main.py @@ -48,10 +48,6 @@ inbox, outbox = Queue(), Queue() connection = None socket = None -sent = 0 -errors = 0 -warnings = 0 - class Greetings: def __init__(self, locale: str, timezone: str, default: str, morning=None, afternoon=None, evening=None, predicate=None): self.locale = locale @@ -325,12 +321,11 @@ def main(driver: WebDriver): index = 0 status = Status.ACTIVE occurrences = {} + sent = 0 + errors = 0 + warnings = 0 while status.isactive() and index < limit: - global warnings - global errors - global sent - attempt = 0 current = index index += 1 @@ -358,7 +353,7 @@ def main(driver: WebDriver): clean = True attempt += 1 request = get_request() - print('[信息] 正在发送:%s (%.2f %%)' % (recipient, current / limit * 100)) + tell('[信息] 正在发送:%s (%.2f %%)' % (recipient, current / limit * 100)) if (target := get_address()) != address: exception = Exception(f'邮件发件地址与设定不一致\n>> {address}\n>> {target}') @@ -490,7 +485,8 @@ def main(driver: WebDriver): status = Status.INACTIVE progress = index / limit * 100 - print('[信息] 当前进度:%.2f %%' % progress) + tell('[信息] 当前进度:%.2f %%' % progress) + tell(f'已发送 {sent} 封;发送失败 {errors} 封;跳过重复项 {warnings} 个') if parameters.get('save'): try: @@ -565,6 +561,4 @@ if __name__ == '__main__': status = 1 finally: driver.quit() - - tell(f'已发送 {sent} 封;发送失败 {errors} 封;跳过重复项 {warnings} 个') - exit(status) + exit(status)