gpt4 book ai didi

python - 错误<0x7f6f60c6b8c0处<__main__.Node实例的绑定(bind)方法Node.getCpuPowerUsage>>

转载 作者:行者123 更新时间:2023-12-01 07:58:31 25 4
gpt4 key购买 nike

我只想在 python 脚本中打印系统的 PowerUsage。我的脚本是监控脚本的一部分。我收到错误 <bound method Node.getCpuPowerUsage of <__main__.Node instance at 0x7f6f60c6b8c0>>


def getPowerUsage(self):
self.powerUsage = os.popen("sudo ipmi-oem intelnm get-node-manager-statistics mode=globalpower | awk '$1 == \"Current\" {print $4}'").read().replace("\n", "")
return self.powerUsage
node1 = Node(0, 0, 0)
node1.getPowerUsage()
node1.getGpuPowerUsage()
node1.getCpuPowerUsage()
print(node1.getPowerUsage)

命令的输出 sudo ipmi-oem intelnm get-node-manager-statistics mode=globalpower | awk '$1 == \"Current\" {print $4}'").read().replace("\n", "")看起来像这样

$sudo ipmi-oem intelnm get-node-manager-statistics mode=globalpower | awk '$1 == \"Current\" {print $4}'").read().replace("\n", "")
185


最佳答案

只需将 print(node1.getPowerUsage) 替换为 print(node1.getPowerUsage()) 就像 gmds 所说的

关于python - 错误<0x7f6f60c6b8c0处<__main__.Node实例的绑定(bind)方法Node.getCpuPowerUsage>>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55825770/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com