lifxlan
lifxlan copied to clipboard
PyPi version out of date, unusable due to now-resolved bug
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).
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.
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
That worked great. Thanks!!
On Fri, Aug 4, 2023 at 11:16 PM pedantic79 @.***> wrote:
@HaberHash https://github.com/HaberHash The problem is that the current version of lifxlan only works with v3 of bitstring, and you have v4 of bitstring.
So your options are:
- If you pip install lifxlan, then run pip list, you should see bitstring 4.0.2 (or some other version 4 bitstring package). To fix this run pip install bitstring==3.1.9, this will force your install to work.
- Rather than installing in a global python package directory, consider using venv https://docs.python.org/3/library/venv.html. Once your venv is activated, then follow the instructions in 1. This solution is useful if you have other things that depend on bitstring and installing bitstring==3.1.9 will conflict globally.
- Wait until there is a version of lifxlan that supports bitstring 4
— Reply to this email directly, view it on GitHub https://github.com/mclarkk/lifxlan/issues/177#issuecomment-1666369208, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIPDGJKU7LTEW4KJSCSSEXTXTW3HNANCNFSM6AAAAAAVBPPJPM . You are receiving this because you were mentioned.Message ID: @.***>