jath03 / openrgb-python

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

error when calling OpenRGBClient() #65

Closed lukas3141 closed 1 year ago

lukas3141 commented 1 year ago

if i run client = OpenRgbClient() i get this error message: >>> client = OpenRGBClient() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.10/site-packages/openrgb/orgb.py", line 386, in __init__ self.update() File "/usr/lib/python3.10/site-packages/openrgb/orgb.py", line 568, in update self.comms.requestDeviceNum() File "/usr/lib/python3.10/site-packages/openrgb/network.py", line 214, in requestDeviceNum self.read() File "/usr/lib/python3.10/site-packages/openrgb/network.py", line 116, in read self.callback(device_id, packet_type, buff[0]) File "/usr/lib/python3.10/site-packages/openrgb/orgb.py", line 398, in _callback self.comms.requestDeviceData(x) File "/usr/lib/python3.10/site-packages/openrgb/network.py", line 207, in requestDeviceData self.read() File "/usr/lib/python3.10/site-packages/openrgb/network.py", line 137, in read self.callback(device_id, packet_type, utils.ControllerData.unpack(data, self._protocol_version)) File "/usr/lib/python3.10/site-packages/openrgb/utils.py", line 599, in unpack mode = ModeData.unpack(data, version, x) File "/usr/lib/python3.10/site-packages/openrgb/utils.py", line 330, in unpack color_mode = ModeColors(parse_var('I', data)) File "/usr/lib/python3.10/enum.py", line 385, in __call__ return cls.__new__(cls, value) File "/usr/lib/python3.10/enum.py", line 710, in __new__ raise ve_exc ValueError: 64 is not a valid ModeColors

I installed openrgb-python with the python-openrgb-git AUR package and use OpenRGB version 0.81 with Python Version 3.10.9

jath03 commented 1 year ago

I don't see this error with the latest python-openrgb-git and the latest openrgb-git, so I'd assume you just need to update you OpenRGB.

andreaahahah commented 7 months ago

I've encountered a similar error indeed I'm not able to execute:

import openrgb
cli = openrgb.OpenRGBClient()

I'm able to import the library just fine, but when i try to do "openrgb.OpenRGBClient()" I get this error right here

Traceback (most recent call last):
  File "C:\Users\butterfly\Desktop\ciao\tastiera\test.py", line 2, in <module>
    cli = openrgb.OpenRGBClient()
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\butterfly\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openrgb\orgb.py", line 381, in __init__
    self.comms = NetworkClient(
                 ^^^^^^^^^^^^^^
  File "C:\Users\butterfly\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openrgb\network.py", line 42, in __init__
    self.start_connection()
  File "C:\Users\butterfly\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openrgb\network.py", line 54, in start_connection
    self.sock.connect((self.address, self.port))
TimeoutError: timed out

I've tried uninstalling the library and installing the latest build from the git repo without any success.

I'm currently using Python 3.11.9.64 from the Microsoft Store in a Windows 11 home 23H3 machine to be more precise the 22631.3296 build

jath03 commented 7 months ago

I'm not sure these issues are related.

Have you enabled the SDK server in OpenRGB? This error means that the library couldn't find a running SDK server to connect to. Is OpenRGB running on the same computer that you are running python on?

andreaahahah commented 7 months ago

Ah sorry I've attached the error with the sdk not running, anyway I've started the Openrgb sdk by launching Openrgb with the --server argument but I get the same error, this one to be more precise Traceback (most recent call last): File "c:\Users\butterfly\Desktop\ciao\tastiera\tempCodeRunnerFile.py", line 1, in <module> cli = openrgb.OpenRGBClient() ^^^^^^^ NameError: name 'openrgb' is not defined

jath03 commented 7 months ago

Looks like you forgot to import openrgb this time? If that didn't fix your issue, post the contents of the tempCodeRunnerFile.py file.

andreaahahah commented 7 months ago

Dude I've told you in the comment before the one I've made yesterday, that I'm able to import correctly the library but if I try to do openrgb.OpenRGBClient() it does give me an error, you told me about the sdk but in the error I've attached in that messagge I've forgot to start the server before copying the error

Where is the tempCodeRunnerFile.py file located? Edit: Now for some reason I'm pretty sure why the code is working