【发布时间】:2012-09-28 16:49:28
【问题描述】:
我正在尝试在我在 FreeBSD 系统上编写的 python 脚本中使用 psutil。在顶部我有:
import _psutil_bsd
然后,当我调用类似 process_iter 的东西时:
for process in _psutil_bsd.process_iter():
if process.name == 'name_I_care_about':
specialProcess = process
但是我收到以下错误:
for process in_psutil_bsd.process_iter():
AttributeError: 'module' object has no attribute 'process_iter'
任何帮助将不胜感激,谢谢
【问题讨论】:
-
您的
for中的 & _psutil_bsd 之间需要一个空格。所以for process in _psutil_bsd.process_iter(): -
抱歉,这只是我帖子中的一个错字,我的代码中确实有空格。