Registry / devops / dmiparser

dmiparser

JSON →
library5.1pypypi✓ verified 72d ago

A library to parse dmidecode output into JSON text. Current version 5.1. Project appears to be in maintenance mode with infrequent releases.

pip install dmiparser
INSTALL
IMPORT
SIG · DMIPARSER
D
dmiparser
devopspythonv5.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

dmiparser
from dmiparser import dmiparser
import dmiparser
The package name and module name differ; use correct import path.

Parse raw dmidecode output to JSON.

from dmiparser import dmiparser import subprocess, json # Get dmidecode output (requires root) try: output = subprocess.check_output(['dmidecode'], stderr=subprocess.STDOUT).decode() except Exception as e: output = "" # fallback if dmidecode not available parser = dmiparser.DMIParser() result = parser.parse_text(output) print(json.dumps(result, indent=2))
Debug
Known issues
gotchaImport path is confusing: the PyPI package is 'dmiparser', but the module to import is also 'dmiparser'. Use 'from dmiparser import dmiparser'.
fix
Use correct import: from dmiparser import dmiparser
affects: all
deprecatedParsing via dmidecode requires root privileges. If the command is not available or fails, the parser will receive empty input.
fix
Ensure dmidecode is installed and run with sudo, or capture output from a file.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'dmiparser'
Incorrect import path or package not installed.
fix
Install: pip install dmiparser, then import: from dmiparser import dmiparser
AttributeError: module 'dmiparser' has no attribute 'DMIParser'
Using import dmiparser instead of from dmiparser import dmiparser.
fix
Use correct import: from dmiparser import dmiparser, then dmiparser.DMIParser()
Upgrade
Version history
5.1latest on PyPI · released Feb 28, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources