jath03 / openrgb-python

A python client for the OpenRGB SDK
GNU General Public License v3.0
115 stars 22 forks source link

ValueError when creating an OpenRGBClient object (Windows 10) #8

Closed cameronshinn closed 3 years ago

cameronshinn commented 4 years ago

Running the example file, I get the following exception:

Traceback (most recent call last):
  File ".\openrgb_test.py", line 4, in <module>
    client = OpenRGBClient()
  File "C:\Users\Cameron\AppData\Local\Programs\Python\Python38-32\lib\site-packages\openrgb\orgb.py", line 234, in __init__
    self.comms.requestDeviceNum()
  File "C:\Users\Cameron\AppData\Local\Programs\Python\Python38-32\lib\site-packages\openrgb\network.py", line 123, in requestDeviceNum
    self.read()
  File "C:\Users\Cameron\AppData\Local\Programs\Python\Python38-32\lib\site-packages\openrgb\network.py", line 94, in read
    self.callback(device_id, packet_type, buff[0])
  File "C:\Users\Cameron\AppData\Local\Programs\Python\Python38-32\lib\site-packages\openrgb\orgb.py", line 247, in _callback
    self.comms.requestDeviceData(x)
  File "C:\Users\Cameron\AppData\Local\Programs\Python\Python38-32\lib\site-packages\openrgb\network.py", line 116, in requestDeviceData
    self.read()
  File "C:\Users\Cameron\AppData\Local\Programs\Python\Python38-32\lib\site-packages\openrgb\network.py", line 105, in read
    self.callback(device_id, packet_type, utils.ControllerData.unpack(data))
  File "C:\Users\Cameron\AppData\Local\Programs\Python\Python38-32\lib\site-packages\openrgb\utils.py", line 443, in unpack
    start, mode = ModeData.unpack(data, start, x)
  File "C:\Users\Cameron\AppData\Local\Programs\Python\Python38-32\lib\site-packages\openrgb\utils.py", line 279, in unpack
    buff[8] = ModeColors(buff[8])
  File "C:\Users\Cameron\AppData\Local\Programs\Python\Python38-32\lib\enum.py", line 309, in __call__
    return cls.__new__(cls, value)
  File "C:\Users\Cameron\AppData\Local\Programs\Python\Python38-32\lib\enum.py", line 600, in __new__
    raise exc
  File "C:\Users\Cameron\AppData\Local\Programs\Python\Python38-32\lib\enum.py", line 584, in __new__
    result = cls._missing_(value)
  File "C:\Users\Cameron\AppData\Local\Programs\Python\Python38-32\lib\enum.py", line 613, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 262144 is not a valid ModeColors

I assume this value is getting pulled from the SDK. I am using version 0.2.3 (pip) and am running Python 3.8.5

jath03 commented 4 years ago

At first glance, this looks like a problem on the server side. What devices do you have that are supported by openrgb?

cameronshinn commented 4 years ago

I have...

Lucasthoelke commented 4 years ago

I'm having the same issue,

Devices:

OpenRGB 0.41 3767b3

RelishedChicken commented 4 years ago

Just to add, I'm seeing the same issue when a this is a dependency.

Devices:

cameronshinn commented 4 years ago

The common factor here seems like the NZXT Kraken cooler

jath03 commented 4 years ago

Nothing seems wrong with the kraken's implementation in OpenRGB. I'm working on adding good logging to get more info and make debugging easier.

jath03 commented 4 years ago

Sorry I haven't gotten around to adding logging yet. From discussion on discord though, it seems like this error is a symptom of SDK connection issues, which are mostly caused by trying to request device info to quickly or in parallel. If you're using multiprocessing, don't. The library is thread-safe, but not multiprocessing-safe, so feel free to replace all multiprocessing with threading. I'll add a section in the docs about this. If this fixes any of your problems, great, otherwise I'll try to make time to add logging

inlart commented 4 years ago

I think PR #11 should fix this. Could you give the latest git version a try? Alternatively you can also update OpenRGB to 23460959 or newer.

jath03 commented 4 years ago

The latest release added some fixes and locking that should (hopefully) help with network stability. Could you lmk if it does or doesn't help at all? If not, which example are you running when you get this error?

cameronshinn commented 4 years ago

Yeah I can run it when I get the chance

jath03 commented 3 years ago

Can anyone here verify that this issue is still occurring?