我在我的python脚本中有这样的乐趣
def start_pushdata_server(Logger):
Logger.write_event("Starting pushdata Server..", "INFO")
retcode, stdout, stderr = run_shell(create_shell_command("pushdata-server
start"))
我们希望将标准错误从pushdata服务器二进制文件重定向到/dev/null
我们这样编辑它:
def start_pushdata_server(Logger):
Logger.write_event("Starting pushdata Server..", "INFO")
retcode, stdout, stderr = run_shell(create_shell_command("pushdata-server
start 2>/dev/null"))
但是添加
2>/dev/null
在Python代码中无效。
在Python代码中,我们如何将所有错误从“pushdata server start”发送到null?