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

PyPi version out of date, unusable due to now-resolved bug #177

Closed
masonlogan1 opened this issue Feb 20, 2023 · 3 comments
Closed

PyPi version out of date, unusable due to now-resolved bug #177

masonlogan1 opened this issue Feb 20, 2023 · 3 comments

Comments

@masonlogan1
Copy link

This appears related to issue #173 which was fixed by #174. According to PyPi, the last version released was May 1, 2021. As of right now, the package available via pip appears to be unusable due to the bitstring.CreationError exception.

Trying to use pip install to include the package in the project and discover lights results in the following error:

from lifxlan import LifxLAN
LifxLAN()
<lifxlan.lifxlan.LifxLAN object at 0x7f781044d520>
LifxLAN().get_lights()
Traceback (most recent call last):
  File "/snap/pycharm-professional/319/plugins/python/helpers/pydev/pydevconsole.py", line 364, in runcode
    coro = func()
  File "<input>", line 1, in <module>
  File "/home/mason/PycharmProjects/lifxflask/venv/lib/python3.8/site-packages/lifxlan/lifxlan.py", line 42, in get_lights
    self.discover_devices()
  File "/home/mason/PycharmProjects/lifxflask/venv/lib/python3.8/site-packages/lifxlan/lifxlan.py", line 50, in discover_devices
    responses = self.broadcast_with_resp(GetService, StateService,)
  File "/home/mason/PycharmProjects/lifxflask/venv/lib/python3.8/site-packages/lifxlan/lifxlan.py", line 234, in broadcast_with_resp
    msg = msg_type(BROADCAST_MAC, self.source_id, seq_num=0, payload=payload, ack_requested=False, response_requested=True)
  File "/home/mason/PycharmProjects/lifxflask/venv/lib/python3.8/site-packages/lifxlan/msgtypes.py", line 19, in __init__
    super(GetService, self).__init__(MSG_IDS[GetService], target_addr, source_id, seq_num, ack_requested, response_requested)
  File "/home/mason/PycharmProjects/lifxflask/venv/lib/python3.8/site-packages/lifxlan/message.py", line 43, in __init__
    self.packed_message = self.generate_packed_message()
  File "/home/mason/PycharmProjects/lifxflask/venv/lib/python3.8/site-packages/lifxlan/message.py", line 47, in generate_packed_message
    self.header = self.get_header()
  File "/home/mason/PycharmProjects/lifxflask/venv/lib/python3.8/site-packages/lifxlan/message.py", line 55, in get_header
    frame_addr = self.get_frame_addr()
  File "/home/mason/PycharmProjects/lifxflask/venv/lib/python3.8/site-packages/lifxlan/message.py", line 80, in get_frame_addr
    mac_addr = little_endian(bitstring.pack(mac_addr_format, convert_MAC_to_int(self.target_addr)))
  File "/home/mason/PycharmProjects/lifxflask/venv/lib/python3.8/site-packages/bitstring.py", line 4689, in pack
    s._addright(BitStream._init_with_token(name, length, value))
  File "/home/mason/PycharmProjects/lifxflask/venv/lib/python3.8/site-packages/bitstring.py", line 1435, in _init_with_token
    raise CreationError(f"Token with length {token_length} packed with value of length {b.len} "
bitstring.CreationError: Token with length 64 packed with value of length 0 (bits:64=0).
@masonlogan1 masonlogan1 changed the title PyPi version out of date, unusable due to previously resolved bug PyPi version out of date, unusable due to now-resolved bug Feb 20, 2023
@pedantic79
Copy link

pedantic79 commented Aug 1, 2023

This is happening because you have bitstring 4 installed. Try forcing a bitstring==3.1.9. Source needs to be updated to support both pyproject.toml and bitstring 4.

@HaberHash
Copy link

Sorry, I'm struggling with the same issue too. How would we set this configuration? I'd be willing to contribute changes to products.py also. I had an issue a while back where my fixtures weren't included. Really need to get back up and running again. Had to switch computers now I'm down.

C:\lifxe131-master>python e131_receive.py
Discovering lights...
Traceback (most recent call last):
File "C:\lifxe131-master\e131_receive.py", line 38, in
lights = lifx.get_lights()
File "C:\Users\billh\AppData\Local\Programs\Python\Python310\lib\site-packages\lifxlan\lifxlan.py", line 42, in get_lights
self.discover_devices()
File "C:\Users\billh\AppData\Local\Programs\Python\Python310\lib\site-packages\lifxlan\lifxlan.py", line 50, in discover_devices
responses = self.broadcast_with_resp(GetService, StateService,)
File "C:\Users\billh\AppData\Local\Programs\Python\Python310\lib\site-packages\lifxlan\lifxlan.py", line 234, in broadcast_with_resp
msg = msg_type(BROADCAST_MAC, self.source_id, seq_num=0, payload=payload, ack_requested=False, response_requested=True)
File "C:\Users\billh\AppData\Local\Programs\Python\Python310\lib\site-packages\lifxlan\msgtypes.py", line 19, in init
super(GetService, self).init(MSG_IDS[GetService], target_addr, source_id, seq_num, ack_requested, response_requested)
File "C:\Users\billh\AppData\Local\Programs\Python\Python310\lib\site-packages\lifxlan\message.py", line 43, in init
self.packed_message = self.generate_packed_message()
File "C:\Users\billh\AppData\Local\Programs\Python\Python310\lib\site-packages\lifxlan\message.py", line 47, in generate_packed_message
self.header = self.get_header()
File "C:\Users\billh\AppData\Local\Programs\Python\Python310\lib\site-packages\lifxlan\message.py", line 55, in get_header
frame_addr = self.get_frame_addr()
File "C:\Users\billh\AppData\Local\Programs\Python\Python310\lib\site-packages\lifxlan\message.py", line 80, in get_frame_addr
mac_addr = little_endian(bitstring.pack(mac_addr_format, convert_MAC_to_int(self.target_addr)))
File "C:\Users\billh\AppData\Local\Programs\Python\Python310\lib\site-packages\bitstring_init_.py", line 4714, in pack
s._append(BitStream.init_with_token(name, length, value))
File "C:\Users\billh\AppData\Local\Programs\Python\Python310\lib\site-packages\bitstring_init
.py", line 1381, in _init_with_token
raise CreationError(f"Token with length {token_length} packed with value of length {b.len} "
bitstring.CreationError: Token with length 64 packed with value of length 0 (bits:64=0).

@HaberHash
Copy link

HaberHash commented Aug 6, 2023 via email

@mclarkk mclarkk closed this as completed Oct 13, 2024
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

4 participants