【发布时间】:2020-03-12 11:25:17
【问题描述】:
我有 Python 脚本,它使用子进程来运行 mosquitto。
Mosquitto 执行成功,但在 Syslog 中写入错误:
Warning: Unable to locate configuration directory, default config not loaded.
这个错误是由 Mosquitto bug 引起的,可能只能通过版本更新排除,但这对我来说是不可能的。
是否有任何可能的方法可以从日志中删除该错误?
据我了解,可以将标准错误发送为 null,但我不知道如何处理标准错误。
例如,我如何运行 mosquitto。
try:
subprocess.check_call(args)
except subprocess.CalledProcessError as e:
sys.stderr.write(
'ERROR: call to mosquitto_pub failed with error code {}\n'.format(e.returncode))
【问题讨论】:
标签: python python-3.x error-handling debian