0

I would like to get the system memory information in python, I can do it if I use WMI, but in my case, I need to do it without using WMI. Is it possible?

Here is the information that I need. I use WMI to do it.

def SystemMemory():
    memorys = []
    for mem in wmiquery.Win32_PhysicalMemory():
        sysmem = {}
        sysmem['DeviceLocator'] = mem.DeviceLocator
        sysmem['BankLabel'] = mem.BankLabel
        sysmem['Capacity'] = mem.Capacity
        sysmem['ConfiguredClockSpeed'] = mem.ConfiguredClockSpeed
        sysmem['Manufacturer'] = mem.Manufacturer
        sysmem['SerialNumber'] = mem.SerialNumber.strip()
        memorys.append(sysmem)
    for m in memorys:
        print(m)

{'DeviceLocator': 'DIMM1', 'BankLabel': 'ChannelB', 'Capacity': '8589934592', 'ConfiguredClockSpeed': 2667, 'Manufacturer': 'Samsung', 'SerialNumber': '032FE733'}
{'DeviceLocator': 'DIMM2', 'BankLabel': 'ChannelB', 'Capacity': '8589934592', 'ConfiguredClockSpeed': 2667, 'Manufacturer': 'Samsung', 'SerialNumber': '032FE776'}
{'DeviceLocator': 'DIMM3', 'BankLabel': 'ChannelA', 'Capacity': '8589934592', 'ConfiguredClockSpeed': 2667, 'Manufacturer': 'Samsung', 'SerialNumber': '032FE729'}
{'DeviceLocator': 'DIMM4', 'BankLabel': 'ChannelA', 'Capacity': '8589934592', 'ConfiguredClockSpeed': 2667, 'Manufacturer': 'Samsung', 'SerialNumber': '032FE7BA'}

Anyone can help me please, really appreciated. Thanks

Cheries
  • 834
  • 1
  • 13
  • 32
  • Does this answer your question? [Get total physical memory in Python](https://stackoverflow.com/questions/22102999/get-total-physical-memory-in-python) – Grismar Apr 09 '21 at 03:31
  • @Grismar no, its not what I need, It only get the total memory not the information that I listed above. – Cheries Apr 09 '21 at 03:49
  • So, you're asking if you can get exactly the information provided by this API call, without calling this API? Do you literally need each and every one of these fields? What have you tried yourself? Can you explain *why* you can't use WMI, if it's clearly the right tool for the job? – Grismar Apr 09 '21 at 03:59

0 Answers0