jath03 / openrgb-python

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

Execution error occurs when trying ot connect to openRGB server through specific platform #51

Closed gvpane closed 1 year ago

gvpane commented 2 years ago

First of all, thank you for writing this module.

I am trying to make Reaper DAW communicate with openRGB through the openrgb-python module using the Reaper IDE in order to bring extra feedback in my studio environment.

I am getting a strange behavior on client = OpenRGBClient() in Reaper IDE in certain conditions and I don't understand where the problem lies. Because it only happens when using the Reaper IDE and an RGB is connected to the openRGB server.

  1. Script execution error doesn't happen when using Jupiter or Python IDE while RGB devices are connected to openRGB.
  2. Script execution error doesn't happen in Reaper IDE when no devices are connected to openRGB.
  3. Same behavior occurs on 2 separate machines with different device types and brandss. (Hyperx Alloy Origins on machine 1 & ASUS x570 Creator motherboard on machine 2)

I have tried using protocol_versions 0, 1, 2, 3 with no luck.

openrgb-python - 0.2.15 openRGB SDK server - 0.7 python version - 3.10.1

One thing I should mention is that when the error occurs, the connection to the openRGB server is done for a split second and then it disappears.

I also tried running the function when the server is offline and got the expected timeout traceback.

Script execution error

Traceback (most recent call last): File "rRGB.py", line 5, in client = OpenRGBClient() File "C:\Users\IVMetalFoundry\AppData\Local\Programs\Python\Python310\lib\site-packages\openrgb\orgb.py", line 337, in init self.update() File "C:\Users\IVMetalFoundry\AppData\Local\Programs\Python\Python310\lib\site-packages\openrgb\orgb.py", line 502, in update self.comms.requestDeviceNum() File "C:\Users\IVMetalFoundry\AppData\Local\Programs\Python\Python310\lib\site-packages\openrgb\network.py", line 188, in requestDeviceNum self.read() File "C:\Users\IVMetalFoundry\AppData\Local\Programs\Python\Python310\lib\site-packages\openrgb\network.py", line 116, in read self.callback(device_id, packet_type, buff[0]) File "C:\Users\IVMetalFoundry\AppData\Local\Programs\Python\Python310\lib\site-packages\openrgb\orgb.py", line 348, in _callback self.comms.requestDeviceData(x) File "C:\Users\IVMetalFoundry\AppData\Local\Programs\Python\Python310\lib\site-packages\openrgb\network.py", line 181, in requestDeviceData self.read() File "C:\Users\IVMetalFoundry\AppData\Local\Programs\Python\Python310\lib\site-packages\openrgb\network.py", line 137, in read self.callback(device_id, packet_type, utils.ControllerData.unpack(data, self._protocol_version)) File "C:\Users\IVMetalFoundry\AppData\Local\Programs\Python\Python310\lib\site-packages\openrgb\utils.py", line 547, in unpack metadata = MetaData.unpack(data, version) File "C:\Users\IVMetalFoundry\AppData\Local\Programs\Python\Python310\lib\site-packages\openrgb\utils.py", line 492, in unpack return cls( TypeError: MetaData() takes no arguments

I haven;t found anymore info regarding this problem other than this traceback. Thank you!

jath03 commented 2 years ago

That is strange. My first thought is that maybe MetaData is a keyword/function/class/something used by Reaper IDE somehow, which is messing it up. Otherwise I don't see how that specific error message is possible. Maybe try running MetaData.__module__.__file__ to see where it's defined? Even if that is the case, it shouldn't be messing with internal library files, which makes this even more strange.

jath03 commented 2 years ago

# 2 is expected because that MetaData() is never even created if there are no devices.

jath03 commented 2 years ago

To clarify, put something like print(MetaData.__module__.__file__) on a new line right before the line the error occurs on and let me know what the output is.

File "C:\Users\IVMetalFoundry\AppData\Local\Programs\Python\Python310\lib\site-packages\openrgb\utils.py", line 492, in unpack return cls(

gvpane commented 2 years ago

Thank you for responding:

I did what you asked

image

it returned:

File "C:\Users\George-Valentin.Pane\AppData\Local\Programs\Python\Python310\lib\site-packages\openrgb\utils.py", line 492, in unpack print(MetaData.module.file) AttributeError: 'str' object has no attribute 'file'. Did you mean: 'le'?

jath03 commented 2 years ago

Oh. oops. Don't give advice when you're tired. Try again without the .__file__ part

gvpane commented 2 years ago

the Reaper IDE has no running output so I had to raise an error instead of print

image

hope it has the answers you need

File "C:\Users\George-Valentin.Pane\AppData\Local\Programs\Python\Python310\lib\site-packages\openrgb\utils.py", line 492, in unpack raise Exception("FOR jath03>>>", MetaData.module, "<<<FOR jath03") Exception: ('FOR jath03>>>', 'openrgb.utils', '<<<FOR jath03')

just for the heck of it I put a try: for the problematic return and the error jumped to another line:

File "C:\Users\George-Valentin.Pane\AppData\Local\Programs\Python\Python310\lib\site-packages\openrgb\utils.py", line 350, in unpack return cls( TypeError: ModeData() takes no arguments

put a try: again and the error jumped again:

File "C:\Users\George-Valentin.Pane\AppData\Local\Programs\Python\Python310\lib\site-packages\openrgb\utils.py", line 441, in unpack return cls( TypeError: ZoneData() takes no arguments

shawnc722 commented 2 years ago

Something that might be worth running, since Reaper seems not to properly understand any of the dataclasses decorators:

from dataclasses import dataclass

@dataclass
class Test:
    test_var: int

    @classmethod
    def test(cls):
        return cls(1)

raise Exception(Test(2).test().test_var)

This runs fine in my (non-Reaper) IDE, but I'm interested to see if Reaper has the same issue with this test case. Sorry if this is irrelevant by now lol.

jath03 commented 1 year ago

I'm going to close this as it hasn't been updated in a while and seemed like the problems ran deeper than openrgb-python.