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

Running simple example fails #8

Closed
palikar opened this issue Jul 3, 2020 · 3 comments
Closed

Running simple example fails #8

palikar opened this issue Jul 3, 2020 · 3 comments

Comments

@palikar
Copy link

palikar commented Jul 3, 2020

I just discovered this library and tried running the provided simple example. I can connect to the OpenRGB server but then I get some internal error when I try to activate a mode for a device. For example, when running zone-change.py, I get

Traceback (most recent call last):
  File "zone-change.py", line 21, in <module>
    mode.active()
  File "/home/sun/code/py_envs/dev/lib/python3.6/site-packages/openrgb/ORGBDevice.py", line 67, in active
    con.set_update_mode(self, device_id=device.id)
  File "/home/sun/code/py_envs/dev/lib/python3.6/site-packages/openrgb/OpenRGB.py", line 115, in set_update_mode
    data=prepend_length(bytes(data)),
  File "/home/sun/code/py_envs/dev/lib/python3.6/site-packages/openrgb/ORGBDevice.py", line 88, in __bytes__
    blob.color(color)
  File "/home/sun/code/py_envs/dev/lib/python3.6/site-packages/openrgb/binreader.py", line 41, in color
    return self._packer('cccx', value)
  File "/home/sun/code/py_envs/dev/lib/python3.6/site-packages/openrgb/binreader.py", line 25, in _packer
    return self._pack(fmt, data)
  File "/home/sun/code/py_envs/dev/lib/python3.6/site-packages/openrgb/binreader.py", line 17, in _pack
    res = struct.pack(fmt, data)
struct.error: pack expected 3 items for packing (got 1)

@bahorn
Copy link
Owner

bahorn commented Jul 4, 2020

Hi!

Had a look into this a bit earlier, doesn't seem to occur in my personal setup but I can see the logic that would cause this to happen.

Should be a fairly minor patch, basically need to add a * in front of data in this specific case where colors are set in a mode. (I believe this was introduced in one of my more recent commits where I restructured the project.)

Should hopeful have a fix up over this over the weekend, though it's a little harder for me to test right now as I'm away from my desktop (still have remote access, but can't see the pretty colors!)

@palikar
Copy link
Author

palikar commented Jul 4, 2020

Oh, okay, thanks for the info. Btw, sorry that I forgot to mention the version of the library I use. I believe I just installed it through pip so whatever the newest version on PyPi, I used that one.

@bahorn
Copy link
Owner

bahorn commented Jul 9, 2020

Ok, should have just resolved this in master, had to check if the argument to Blob._pack is either a tuple or a list.

Going to push this version this PyPi.

Will reopen if it turns out I broke it again.

Thanks!

@bahorn bahorn closed this as completed Jul 9, 2020
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