Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AudioUtilities.GetAllDevices() - COMError and 'Invalid pointer' #69

Open
QuadCorei8085 opened this issue Aug 11, 2022 · 3 comments
Open

Comments

@QuadCorei8085
Copy link

  • OS version
    Windows10 64bit
  • Python version
    Python 3.9.7
  • pycaw version
    pycaw==20220416
  • project files
    example

The following example results the command line errors below:

`from ctypes import POINTER, cast

from comtypes import CLSCTX_ALL

from pycaw.pycaw import AudioUtilities, IAudioEndpointVolume
from pycaw.pycaw import ISimpleAudioVolume

def main():
#sessions = AudioUtilities.GetAllSessions()
devices = AudioUtilities.GetAllDevices()
print(devices)

for d in devices:
    print('{} = {}'.format(d.FriendlyName, d.EndpointVolume.GetMasterVolumeLevel()))

if name == "main":
main()`

output:

C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 58 from device <POINTER(IMMDevice) ptr=0x1c021d4a400 at 1c02228cac0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 59 from device <POINTER(IMMDevice) ptr=0x1c021d4a400 at 1c02228cac0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 60 from device <POINTER(IMMDevice) ptr=0x1c021d4a360 at 1c02228ccc0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 61 from device <POINTER(IMMDevice) ptr=0x1c021d4a360 at 1c02228ccc0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 59 from device <POINTER(IMMDevice) ptr=0x1c021d4a3b0 at 1c02228ca40>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 60 from device <POINTER(IMMDevice) ptr=0x1c021d4a3b0 at 1c02228ca40>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 60 from device <POINTER(IMMDevice) ptr=0x1c021d4a8b0 at 1c0222b7940>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 61 from device <POINTER(IMMDevice) ptr=0x1c021d4a8b0 at 1c0222b7940>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 17 from device <POINTER(IMMDevice) ptr=0x1c021d4a860 at 1c0222b7bc0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 18 from device <POINTER(IMMDevice) ptr=0x1c021d4a860 at 1c0222b7bc0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 60 from device <POINTER(IMMDevice) ptr=0x1c021d4a5e0 at 1c0223964c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 61 from device <POINTER(IMMDevice) ptr=0x1c021d4a5e0 at 1c0223964c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 60 from device <POINTER(IMMDevice) ptr=0x1c021d49fa0 at 1c0223961c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 61 from device <POINTER(IMMDevice) ptr=0x1c021d49fa0 at 1c0223961c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 60 from device <POINTER(IMMDevice) ptr=0x1c021d49ff0 at 1c0223965c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 61 from device <POINTER(IMMDevice) ptr=0x1c021d49ff0 at 1c0223965c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 59 from device <POINTER(IMMDevice) ptr=0x1c011b30200 at 1c022396b40>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 60 from device <POINTER(IMMDevice) ptr=0x1c011b30200 at 1c022396b40>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 59 from device <POINTER(IMMDevice) ptr=0x1c011b2ffd0 at 1c022396cc0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 60 from device <POINTER(IMMDevice) ptr=0x1c011b2ffd0 at 1c022396cc0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 59 from device <POINTER(IMMDevice) ptr=0x1c011b2ff80 at 1c0223c63c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 60 from device <POINTER(IMMDevice) ptr=0x1c011b2ff80 at 1c0223c63c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 16 from device <POINTER(IMMDevice) ptr=0x1c021d6ddb0 at 1c0223c6440>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 17 from device <POINTER(IMMDevice) ptr=0x1c021d6ddb0 at 1c0223c6440>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 20 from device <POINTER(IMMDevice) ptr=0x1c021d6d810 at 1c0223c6540>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 21 from device <POINTER(IMMDevice) ptr=0x1c021d6d810 at 1c0223c6540>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 16 from device <POINTER(IMMDevice) ptr=0x1c021d6d630 at 1c0223c6140>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 17 from device <POINTER(IMMDevice) ptr=0x1c021d6d630 at 1c0223c6140>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 50 from device <POINTER(IMMDevice) ptr=0x1c021d6dcc0 at 1c0223c6640>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 51 from device <POINTER(IMMDevice) ptr=0x1c021d6dcc0 at 1c0223c6640>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 52 from device <POINTER(IMMDevice) ptr=0x1c021d6d950 at 1c0223c69c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 53 from device <POINTER(IMMDevice) ptr=0x1c021d6d950 at 1c0223c69c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 52 from device <POINTER(IMMDevice) ptr=0x1c021d6d860 at 1c0223c6e40>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 53 from device <POINTER(IMMDevice) ptr=0x1c021d6d860 at 1c0223c6e40>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 52 from device <POINTER(IMMDevice) ptr=0x1c021d6e210 at 1c0223ea7c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 53 from device <POINTER(IMMDevice) ptr=0x1c021d6e210 at 1c0223ea7c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 52 from device <POINTER(IMMDevice) ptr=0x1c021d6e120 at 1c0223ea8c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 53 from device <POINTER(IMMDevice) ptr=0x1c021d6e120 at 1c0223ea8c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 52 from device <POINTER(IMMDevice) ptr=0x1c021d6e0d0 at 1c0223eac40>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 53 from device <POINTER(IMMDevice) ptr=0x1c021d6e0d0 at 1c0223eac40>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 49 from device <POINTER(IMMDevice) ptr=0x1c021d6e1c0 at 1c0223ea040>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 50 from device <POINTER(IMMDevice) ptr=0x1c021d6e1c0 at 1c0223ea040>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 52 from device <POINTER(IMMDevice) ptr=0x1c021d6da90 at 1c022408140>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 53 from device <POINTER(IMMDevice) ptr=0x1c021d6da90 at 1c022408140>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 16 from device <POINTER(IMMDevice) ptr=0x1c021d6e490 at 1c0224082c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 17 from device <POINTER(IMMDevice) ptr=0x1c021d6e490 at 1c0224082c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 52 from device <POINTER(IMMDevice) ptr=0x1c021d6df90 at 1c0224084c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 53 from device <POINTER(IMMDevice) ptr=0x1c021d6df90 at 1c0224084c0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 52 from device <POINTER(IMMDevice) ptr=0x1c021d6d8b0 at 1c022408540>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 53 from device <POINTER(IMMDevice) ptr=0x1c021d6d8b0 at 1c022408540>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 49 from device <POINTER(IMMDevice) ptr=0x1c021d6e3a0 at 1c022408ac0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 50 from device <POINTER(IMMDevice) ptr=0x1c021d6e3a0 at 1c022408ac0>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 52 from device <POINTER(IMMDevice) ptr=0x1c021d6d5e0 at 1c022408840>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
C:\Python\lib\site-packages\pycaw\utils.py:225: UserWarning: COMError attempting to get property 53 from device <POINTER(IMMDevice) ptr=0x1c021d6d5e0 at 1c022408840>: COMError(-536870389, None, (None, None, None, 0, None))
warnings.warn(
[<pycaw.utils.AudioDevice object at 0x000001C011C47FA0>, <pycaw.utils.AudioDevice object at 0x000001C011C47EE0>, <pycaw.utils.AudioDevice object at 0x000001C0221FBEE0>, <pycaw.utils.AudioDevice object at 0x000001C011C47C70>, <pycaw.utils.AudioDevice object at 0x000001C013418820>, <pycaw.utils.AudioDevice object at 0x000001C022205BB0>, <pycaw.utils.AudioDevice object at 0x000001C022205C40>, <pycaw.utils.AudioDevice object at 0x000001C022205CD0>, <pycaw.utils.AudioDevice object at 0x000001C022205D60>, <pycaw.utils.AudioDevice object at 0x000001C022205EB0>, <pycaw.utils.AudioDevice object at 0x000001C02220E040>, <pycaw.utils.AudioDevice object at 0x000001C02220ECD0>, <pycaw.utils.AudioDevice object at 0x000001C02221A5B0>, <pycaw.utils.AudioDevice object at 0x000001C0222A5220>, <pycaw.utils.AudioDevice object at 0x000001C0222A5280>, <pycaw.utils.AudioDevice object at 0x000001C0222A52E0>, <pycaw.utils.AudioDevice object at 0x000001C0222A5340>, <pycaw.utils.AudioDevice object at 0x000001C0222A53D0>, <pycaw.utils.AudioDevice object at 0x000001C0222A5430>, <pycaw.utils.AudioDevice object at 0x000001C0222A5490>, <pycaw.utils.AudioDevice object at 0x000001C0222A54F0>, <pycaw.utils.AudioDevice object at 0x000001C0222A5550>, <pycaw.utils.AudioDevice object at 0x000001C0222A55B0>, <pycaw.utils.AudioDevice object at 0x000001C0222A5610>, <pycaw.utils.AudioDevice object at 0x000001C0222A5670>, <pycaw.utils.AudioDevice object at 0x000001C0222A56D0>, <pycaw.utils.AudioDevice object at 0x000001C0222A5730>, <pycaw.utils.AudioDevice object at 0x000001C0222A5790>, <pycaw.utils.AudioDevice object at 0x000001C0222A57F0>, <pycaw.utils.AudioDevice object at 0x000001C0222A5850>, <pycaw.utils.AudioDevice object at 0x000001C0222A58B0>, <pycaw.utils.AudioDevice object at 0x000001C0222A5910>, <pycaw.utils.AudioDevice object at 0x000001C0222A5970>, <pycaw.utils.AudioDevice object at 0x000001C0222A59D0>, <pycaw.utils.AudioDevice object at 0x000001C0222A5A30>, <pycaw.utils.AudioDevice object at 0x000001C0222A5A90>, <pycaw.utils.AudioDevice object at 0x000001C0222A5AF0>, <pycaw.utils.AudioDevice object at 0x000001C0222A5B50>, <pycaw.utils.AudioDevice object at 0x000001C0222A5BB0>, <pycaw.utils.AudioDevice object at 0x000001C0222A5C10>, <pycaw.utils.AudioDevice object at 0x000001C0222A5C70>, <pycaw.utils.AudioDevice object at 0x000001C0222A5CD0>, <pycaw.utils.AudioDevice object at 0x000001C0222A5D30>, <pycaw.utils.AudioDevice object at 0x000001C0222A5D90>, <pycaw.utils.AudioDevice object at 0x000001C0222A5DF0>, <pycaw.utils.AudioDevice object at 0x000001C0222A5E50>, <pycaw.utils.AudioDevice object at 0x000001C0222A5EB0>, <pycaw.utils.AudioDevice object at 0x000001C0222A5F10>, <pycaw.utils.AudioDevice object at 0x000001C0222A5F70>, <pycaw.utils.AudioDevice object at 0x000001C0222A5FD0>, <pycaw.utils.AudioDevice object at 0x000001C0223E9070>, <pycaw.utils.AudioDevice object at 0x000001C0223E90D0>, <pycaw.utils.AudioDevice object at 0x000001C0223E9130>, <pycaw.utils.AudioDevice object at 0x000001C0223E9190>, <pycaw.utils.AudioDevice object at 0x000001C0223E91F0>, <pycaw.utils.AudioDevice object at 0x000001C0223E9250>, <pycaw.utils.AudioDevice object at 0x000001C0223E92B0>, <pycaw.utils.AudioDevice object at 0x000001C0223E9310>, <pycaw.utils.AudioDevice object at 0x000001C0223E9370>, <pycaw.utils.AudioDevice object at 0x000001C0223E93D0>, <pycaw.utils.AudioDevice object at 0x000001C0223E9430>, <pycaw.utils.AudioDevice object at 0x000001C0223E9490>, <pycaw.utils.AudioDevice object at 0x000001C0223E94F0>, <pycaw.utils.AudioDevice object at 0x000001C0223E9550>, <pycaw.utils.AudioDevice object at 0x000001C0223E95B0>, <pycaw.utils.AudioDevice object at 0x000001C0223E9610>, <pycaw.utils.AudioDevice object at 0x000001C0223E9670>, <pycaw.utils.AudioDevice object at 0x000001C0223E96D0>, <pycaw.utils.AudioDevice object at 0x000001C0223E9730>, <pycaw.utils.AudioDevice object at 0x000001C0223E9790>, <pycaw.utils.AudioDevice object at 0x000001C0223E97F0>, <pycaw.utils.AudioDevice object at 0x000001C0223E9850>, <pycaw.utils.AudioDevice object at 0x000001C0223E98B0>, <pycaw.utils.AudioDevice object at 0x000001C0223E9910>, <pycaw.utils.AudioDevice object at 0x000001C0223E9970>, <pycaw.utils.AudioDevice object at 0x000001C0223E99D0>, <pycaw.utils.AudioDevice object at 0x000001C0223E9A30>, <pycaw.utils.AudioDevice object at 0x000001C0223E9A90>, <pycaw.utils.AudioDevice object at 0x000001C0223E9AF0>, <pycaw.utils.AudioDevice object at 0x000001C0223E9B50>, <pycaw.utils.AudioDevice object at 0x000001C0223E9BB0>, <pycaw.utils.AudioDevice object at 0x000001C0223E9C10>, <pycaw.utils.AudioDevice object at 0x000001C0223E9C70>, <pycaw.utils.AudioDevice object at 0x000001C0223E9CD0>]
Hangszórók (SpeechMike III) = -16.8125
Hangszórók (12- SpeechMike III) = 0.0
None = 0.0
Hangszórók (13- SpeechMike III) = 0.0
None = 0.0
None = 0.0
Kopfhoerer (Realtek(R) Audio) = 0.0
Hangszórók (6- SpeechMike III) = 0.0
None = 0.0
Hangszórók (16- SpeechMike III) = 0.0
VX2758-Series (Intel(R) Display Audio) = -13.886737823486328
Traceback (most recent call last):
File "D:\test.py", line 17, in
main()
File "D:\test.py", line 14, in main
print('{} = {}'.format(d.FriendlyName, d.EndpointVolume.GetMasterVolumeLevel()))
File "C:\Python\lib\site-packages\pycaw\utils.py", line 41, in EndpointVolume
iface = self._dev.Activate(
_ctypes.COMError: (-2147467261, 'Invalid pointer', (None, None, None, 0, None))

@KillerBOSS2019
Copy link
Contributor

I am guessing it's because it's trying to get properties of a device that is not connected aka not connected. You can use this code that I wrote. It basically only gets the active audio devices using EnumAudioEndpoints to filter

def getAllDevices(direction, State = DEVICE_STATE.ACTIVE.value):
        devices = {}
        # for all use EDataFlow.eAll.value
        if direction == "Input":
            Flow = EDataFlow.eCapture.value     # 1
        else:
            # Output
            Flow = EDataFlow.eRender.value      # 0
        comtypes.CoInitialize()
        deviceEnumerator = comtypes.CoCreateInstance(
            CLSID_MMDeviceEnumerator,
            IMMDeviceEnumerator,
            comtypes.CLSCTX_INPROC_SERVER)
        if deviceEnumerator is None:
            return devices
        

        collection = deviceEnumerator.EnumAudioEndpoints(Flow, State)
        if collection is None:
            return devices

        count = collection.GetCount()
        for i in range(count):
            dev = collection.Item(i)
            if dev is not None:
                createDev = AudioUtilities.CreateDevice(dev)
                if not ": None" in str(createDev):
                    devices[createDev.FriendlyName] = createDev.id
                createDev._dev.Release()
                
        comtypes.CoUninitialize()
        return devices

@KillerBOSS2019
Copy link
Contributor

Also next time. when posting your code use code block and output should also be in a text block. so it's easier to see and also it looks better (:

@TJ-59
Copy link

TJ-59 commented May 14, 2024

Those are only warnings, if you do not want it to show on your "console", you can ignore them using this :

import warnings
[...]
with warnings.catch_warnings(action="ignore"):
    devices = AudioUtilities.GetAllDevices()
[...]

This is the python 3.11+ syntax, if you're using an earlier version, use this :

import warnings
[...]
with warnings.catch_warnings():
    warnings.simplefilter("ignore")
    devices = AudioUtilities.GetAllDevices()
[...]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants