1
0
mirror of https://github.com/JoelBender/bacpypes synced 2025-09-28 22:15:23 +08:00

socket.inet_ntoa() does not like bytearray's

This commit is contained in:
Joel Bender 2015-09-16 15:18:00 -04:00
parent c05f9c1aab
commit 7ad5c34e20

View File

@ -335,6 +335,8 @@ def pack_ip_addr(addr):
def unpack_ip_addr(addr):
"""Given a six-octet BACnet address, return an IP address tuple."""
if isinstance(addr, bytearray):
addr = bytes(addr)
return (socket.inet_ntoa(addr[0:4]), struct.unpack('!H', addr[4:6])[0])
#