Created
July 6, 2021 16:02
-
-
Save gavinsykes/6cba57fdcacaffb0080680cbb4fd47d4 to your computer and use it in GitHub Desktop.
Python script to get a machine's specs and output them into a JSON file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import platform | |
import psutil | |
import json | |
uname = platform.uname() | |
cpu = psutil.cpu_freq() | |
mem = psutil.virtual_memory() | |
environment = { | |
'os':uname.system, | |
'os_release':uname.release, | |
'os_version':uname.version, | |
'machine':uname.machine, | |
'processor':uname.processor, | |
'cpu_freq':cpu.current, | |
'memory':mem.total | |
} | |
f = open('env_info.json','w') | |
if f.mode == 'w': | |
f.write(json.dumps(environment)) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment