This issue is from a Codex global scan of the repository.
simplify.run_iter() crashes when SMTP logging handlers are configured because logging.handlers is not imported.
Evidence:
|
import glob |
|
import logging |
|
import os |
|
import queue |
|
from collections import defaultdict |
|
if mdata.get("handlers", None): |
|
if mdata["handlers"].get("smtp", None): |
|
que = queue.Queue(-1) |
|
queue_handler = logging.handlers.QueueHandler(que) |
|
smtp_handler = logging.handlers.SMTPHandler(**mdata["handlers"]["smtp"]) |
|
listener = logging.handlers.QueueListener(que, smtp_handler) |
|
dlog.addHandler(queue_handler) |
|
listener.start() |
The module imports logging, but not logging.handlers. In Python, import logging alone does not expose logging.handlers, so any mdata["handlers"]["smtp"] configuration raises AttributeError: module 'logging' has no attribute 'handlers' before the workflow starts.
Expected behavior: import logging.handlers before using QueueHandler, SMTPHandler, and QueueListener, as the generator path does implicitly/explicitly where needed.
This issue is from a Codex global scan of the repository.
simplify.run_iter()crashes when SMTP logging handlers are configured becauselogging.handlersis not imported.Evidence:
dpgen/dpgen/simplify/simplify.py
Lines 12 to 16 in 7af5246
dpgen/dpgen/simplify/simplify.py
Lines 538 to 545 in 7af5246
The module imports
logging, but notlogging.handlers. In Python,import loggingalone does not exposelogging.handlers, so anymdata["handlers"]["smtp"]configuration raisesAttributeError: module 'logging' has no attribute 'handlers'before the workflow starts.Expected behavior: import
logging.handlersbefore usingQueueHandler,SMTPHandler, andQueueListener, as the generator path does implicitly/explicitly where needed.