问题标签 [system-profiler]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
97 浏览

python-3.x - 使用 plistlib 访问 system_profiler plist 项目

我正在尝试访问生成的 plistserial_number中第一个数组的键:_items

这是Python代码:

我收到的错误是:'int' object is not subscriptable。我假设这是因为我试图在第 9 行访问 plist 的键的方式,但我无法弄清楚。

任何帮助将不胜感激!

0 投票
0 回答
13 浏览

macos - system_profiler 命令并不总是显示所有属性

我注意到执行以下命令并不总是打印所有相同的属性:

有时,此命令会打印以下属性,但有时不会:

  • 次要类型(耳机、键盘、鼠标)
  • 电池电量
  • 固件版本

如果我重新启动计算机,则会显示属性,但并非总是如此。这似乎很随机。什么时候显示这些属性,我可以“强制刷新”此视图以始终打印所有内容吗?我认为添加detailLevel参数会改变一些东西,但事实并非如此。

0 投票
0 回答
27 浏览

python - Python subprocess check_output return different result than running directly in terminal

Running same command directly in terminal returns a different output than running via subprocess.check_output. Anyone know what is causing this?

running in terminal result a line Chip: Apple M1

but this line is not present if running via subprocess, instead this line shows up Processor Name: Unknown

strange?