[python-win32] Re: [Python-Dev] Still looking for volunteer to

Roger Upole rwupole at msn.com
Tue Mar 14 01:51:47 CET 2006


Trent Mick wrote:
> Does anybody know of a way to programmatically check if a particular
> Windows box has a soundcard installed and configured?
> 
> Background:
> I'm running a Windows buildbot for Python and the test suite fails on
> test_winsound.py because the box doesn't have a sound card setup. (The
> "Sound" Control Panel items says there are "No Playback Devices" for
> Sound Playback.)

WMI can list sound devices.

import win32com.client
wmi=win32com.client.GetObject('winmgmts:')
scs=wmi.InstancesOf('win32_sounddevice')
for sc in scs:
  print  sc.Properties_('Name'), sc.Properties_('Status')


You might also have to check one of the other properties
to make sure the device is actually operating, I don't
have a non-functional device to test with.

       Roger



More information about the Python-win32 mailing list