我正在使用此脚本从收件箱中删除邮件。
if(not debug):
logging.debug("removing messages")
all_mail.lock()
for message in all_mail:
all_mail.remove(message)
all_mail.flush()
all_mail.unlock()
all_mail.close()
运行此脚本一次后,我注意到/var/spool/mail
. 如果我再次尝试运行脚本,我会得到一个相当可预测的异常:mailbox.ExternalClashError: dot lock unavailable
所以看起来 all_mail.unlock() 不起作用,但我不确定还能做什么。