steveo225
steveo225

Reputation: 11882

Detect graphics driver information in Python

I have an application the requires a minimum version of NVIDIA's graphics drivers installed to work. How can I get the driver version that is installed via Python on Windows?

EDIT:

A way to do this via the registry, which gives you all version installed (courtesy of Yojimbo)

cmd = r'reg query "HKEY_LOCAL_MACHINE\SOFTWARE\NVIDIA Corporation\Installer2\Stripped" /s | find "Display.Driver/"'
output = subprocess.check_output(cmd, shell=True)
all = [float(x) for x in re.findall('Display\.Driver/(\d+\.?\d*)', str(output))]
latest = max(all)

Upvotes: 3

Views: 5593

Answers (2)

Tomasz Plonka
Tomasz Plonka

Reputation: 305

The WMI method mentioned above will give you the file version, not the actual driver version you expect. You need to install NVidia WMI and connect to root/CIMV@/NV namespace, where you can find System object with verDisplayDriver property that gives the driver version.

nvidia = wmi.WMI(computer, user=r"usern", password="pass", namespace="/root/cimv2/NV", find_classes=True)
for o in nvidia.System() :
    print o.verDisplayDriver.strValue

Upvotes: 0

Mike Driscoll
Mike Driscoll

Reputation: 33071

You might be able to use the wmi module, which requires PyWin32. Something like this, maybe:

import wmi

c = wmi.WMI()

video =  c.Win32_videocontroller
print video.properties

I don't have a real Windows box at the moment and my Windows VM is returning a bunch of Nones, but I think this should work.

Upvotes: 1

Related Questions