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

Getting confusing parsing[?] error running example code #35

Closed
apolunar opened this issue Aug 12, 2021 · 4 comments
Closed

Getting confusing parsing[?] error running example code #35

apolunar opened this issue Aug 12, 2021 · 4 comments

Comments

@apolunar
Copy link

apolunar commented Aug 12, 2021

The below error is generated every time I run the example code given by the readme. I don't know if it's a silly mistake on my part or a problem with the module. Honestly, it's probably the former. Also a screenshot showing the server I have running in OpenRGB and that a client did connect to it.

image

  File "C:\Users\[user]\anaconda3\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\[user]\anaconda3\lib\site-packages\openrgb\utils.py", line 547, in unpack
    metadata = MetaData.unpack(data, version)
  File "C:\Users\[user]\anaconda3\lib\site-packages\openrgb\utils.py", line 489, in unpack
    serial = parse_string(data)
  File "C:\Users\[user]\anaconda3\lib\site-packages\openrgb\utils.py", line 116, in parse_string     
    return parse_var(f'{length}s', data).decode().rstrip('\x00')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa6 in position 0: invalid start byte

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "example_code.py", line 4, in <module>
    client = OpenRGBClient()
  File "C:\Users\[user]\anaconda3\lib\site-packages\openrgb\orgb.py", line 287, in __init__
    self.comms.requestDeviceNum()
  File "C:\Users\[user]\anaconda3\lib\site-packages\openrgb\network.py", line 188, in requestDeviceNum
    self.read()
  File "C:\Users\[user]\anaconda3\lib\site-packages\openrgb\network.py", line 116, in read
    self.callback(device_id, packet_type, buff[0])
  File "C:\Users\[user]\anaconda3\lib\site-packages\openrgb\orgb.py", line 302, in _callback
    self.comms.requestDeviceData(x)
  File "C:\Users\[user]\anaconda3\lib\site-packages\openrgb\network.py", line 181, in requestDeviceData
    self.read()
  File "C:\Users\[user]\anaconda3\lib\site-packages\openrgb\network.py", line 139, in read
    raise utils.ControllerParsingError(f"Unable to parse data from request `{packet_type}` for device #{device_id}") from e
openrgb.utils.ControllerParsingError: Unable to parse data from request `1` for device #1```





@plutonium-239
Copy link

The error doesn't pertain to openrgb, it's a UnicodeDecodeError, or, the data that you are trying to parse is not utf-8. I don't know what your data is, so can't tell what codec to use.

@apolunar
Copy link
Author

Thanks for the quick response!
I think that even if I did know what codec to use, I wouldn't know what to do with it because the actual error is occurring within OpenRGB itself -

File "C:\Users\[user]\anaconda3\lib\site-packages\openrgb\orgb.py", line 287, in __init__
   self.comms.requestDeviceNum()
 File "C:\Users\[user]\anaconda3\lib\site-packages\openrgb\network.py", line 188, in requestDeviceNum
   self.read()

...
And, python throws the error on the first line of the example code provided by the readme-

Traceback (most recent call last):
  File "example_code.py", line 4, in <module>
    client = OpenRGBClient()

The code that goes on inside of OpenRGBClient() is not really something I have control over. What I do have control over is my rgb devices and how OpenRGB is setup, I'm thinking the error comes from one of those two places as they are the only two places that I can think of where data might be coming in. As you said, the data OpenRGB is trying to parse is not utf-8, but alas I did not provide that data directly through code meaning the solution will probably be figuring out what that data is and how to change it... after all, it got the bad data in some other place. You know what they say, garbage in, garbage out lol

I could be totally wrong with all of this, but these are my thoughts. I'll keep trying to figure this error out, thanks for your help thus far.

@jath03
Copy link
Owner

jath03 commented Aug 12, 2021

See the newly pinned issue (#33)

@jath03 jath03 closed this as completed Aug 12, 2021
@jath03
Copy link
Owner

jath03 commented Aug 12, 2021

Feel free to reopen if you are having a different problem.

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

3 participants