我在使用check\ u output函数时收到警告,无法重定向警告。我想stderr只会接受错误和错误子流程检查输出无法处理警告(但不确定)。有人能建议吗?你知道吗
def getSnapshot(volumeName):
try:
snapID, snapAttach = check_output(["openstack", "volume", "snapshot", "list", "--volume", volumeName, "-c", "Name", "-c", "ID", "-f", "value"]).rstrip().split()
myDict['snapshot'] = [snapAttach, snapID]
except ValueError:
myDict['snapshot'] = None
return myDict
警告类型:
WARNING: openstackclient.common.utils is deprecated and will be removed after Jun 2017. Please use osc_lib.utils. This warning is caused by an out-of-date import in /usr/local/lib/python2.7/dist-packages/heatclient/osc/plugin.py\nIgnoring domain related config project_domain_id because identity API version is 2.0\n
可能适合你想要的。https://docs.python.org/2/library/warnings.html
相关问题 更多 >
编程相关推荐