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

Sample Code under "usage" does not work #74

Open
Knutowskie opened this issue Oct 13, 2024 · 2 comments
Open

Sample Code under "usage" does not work #74

Knutowskie opened this issue Oct 13, 2024 · 2 comments

Comments

@Knutowskie
Copy link

So i started to fiddle around with python and openrgb.

Tried your sample code and get the following error:

PS C:\Users\Knuto> & C:/Users/Knuto/AppData/Local/Programs/Python/Python313/python.exe c:/Users/Knuto/Documents/python_scripts/OpenRGB_Test.py Traceback (most recent call last): File "c:\Users\Knuto\Documents\python_scripts\OpenRGB_Test.py", line 4, in <module> client = OpenRGBClient('127.0.0.1', 6742, 'pyclient') File "C:\Users\Knuto\AppData\Local\Programs\Python\Python313\Lib\site-packages\openrgb\orgb.py", line 388, in __init__ self.update() ~~~~~~~~~~~^^ File "C:\Users\Knuto\AppData\Local\Programs\Python\Python313\Lib\site-packages\openrgb\orgb.py", line 580, in update self.update_profiles() ~~~~~~~~~~~~~~~~~~~~^^ File "C:\Users\Knuto\AppData\Local\Programs\Python\Python313\Lib\site-packages\openrgb\orgb.py", line 588, in update_profiles self.comms.requestProfileList() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "C:\Users\Knuto\AppData\Local\Programs\Python\Python313\Lib\site-packages\openrgb\network.py", line 221, in requestProfileList self.read() ~~~~~~~~~^^ File "C:\Users\Knuto\AppData\Local\Programs\Python\Python313\Lib\site-packages\openrgb\network.py", line 169, in read self.callback(device_id, packet_type, utils.parse_list(utils.Profile, idata, self._protocol_version)) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Knuto\AppData\Local\Programs\Python\Python313\Lib\site-packages\openrgb\utils.py", line 148, in parse_list things.append(kind.unpack(data, version, x)) # type: ignore ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ File "C:\Users\Knuto\AppData\Local\Programs\Python\Python313\Lib\site-packages\openrgb\utils.py", line 681, in unpack s = parse_string(data) File "C:\Users\Knuto\AppData\Local\Programs\Python\Python313\Lib\site-packages\openrgb\utils.py", line 123, in parse_string return parse_var(f'{length}s', data).decode().rstrip('\x00') ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 2: invalid start byte

How can i avoid this? Running OpenRGB latest.

@Knutowskie
Copy link
Author

Knutowskie commented Oct 13, 2024

So he is yelling about this:

def parse_string(data: Iterator[int]) -> str:
'''
Parses a string based on a size.
:param data: the raw data to parse
:returns: A parsed string
'''
length = parse_var('H', data)
return parse_var(f'{length}s', data).decode().rstrip('\x00')

After some more testing and setting up Ubuntu in WSL there it is the very same error.

I needed to change the line

client = OpenRGBClient('192.168.0.22', 6742, 'python-client')

but still no luck.

@jath03
Copy link
Owner

jath03 commented Oct 24, 2024

Can you test with v0.3.2 and if there is still a problem post the error message?

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

2 participants