Python WMI -Bildschirmhelligkeitsanmieter erhält Fehler 0x8004100cPython

Python-Programme
Anonymous
 Python WMI -Bildschirmhelligkeitsanmieter erhält Fehler 0x8004100c

Post by Anonymous »

Ich arbeite gerade an einem Skript, das ein Tray -Symbol erstellt, mit dem der Benutzer die Bildschirmhelligkeit durch Menüoptionen anpassen kann. Der in Python 3.6.8 geschriebene Quellcode finden Sie hier. Es scheint eine Fehlermeldung zu geben, wenn versucht wird, eine der Helligkeitsoptionen auszuwählen. Ich habe einige Lesen gemacht und festgestellt, dass der Fehler, den ich erhalte (WMI -Fehlerreferenz: 0x8004100c), auf eine Funktion oder Operation bezieht, die nicht unterstützt wird. Gibt es dafür eine Problemumgehung?

Code: Select all

Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\wmi.py", line 817, in query
return self._namespace.query (wql, self, fields)
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\wmi.py", line 1009, in query
return [ _wmi_object (obj, instance_of, fields) for obj in self._raw_query(wql) ]
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\wmi.py", line 1009, in 
return [ _wmi_object (obj, instance_of, fields) for obj in self._raw_query(wql) ]
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\win32com\client\dynamic.py", line 252, in __getitem__
return self._get_good_object_(self._enum_.__getitem__(index))
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\win32com\client\util.py", line 37, in __getitem__
return self.__GetIndex(index)
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\win32com\client\util.py", line 53, in __GetIndex
result = self._oleobj_.Next(1)
pywintypes.com_error: (-2147217396, 'OLE error 0x8004100c', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "_ctypes/callbacks.c", line 234, in 'calling callback function'
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\infi\systray\traybar.py", line 79, in WndProc
self._message_dict[msg](hwnd, msg, wparam.value, lparam.value)
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\infi\systray\traybar.py", line 278, in _command
self._execute_menu_option(id)
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\infi\systray\traybar.py", line 285, in _execute_menu_option
menu_action(self)
File "d:\Code-Dev\Pyhthon\systray brightness\brightness.py", line 41, in bri_25
br = c.WmiMonitorBrightnessMethods()[0]
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\wmi.py", line 819, in query
handle_com_error ()
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\wmi.py", line 241, in handle_com_error
raise klass (com_error=err)
wmi.x_wmi: 
< /code>
Benötige Modulepip install infi.systray
pip install wmi
< /code>
Code -Snip, von dem ich glaube, dass er den Fehler erzeugt: < /p>
from infi.systray import SysTrayIcon
import wmi

def brightness_50(systray):
'''brightness: 50%'''
b = 50
c = wmi.WMI(namespace='root\\wmi')

br = c.WmiMonitorBrightnessMethods()[0]
br.WmiSetBrightness(3, b) #b will be a precentage / 100

menu = (("brightness: 100%", None, brightness_50))

systray = SysTrayIcon("icon.ico", "brightness", menu)

systray.start()

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post