Skip to content

Commit

Permalink
tcpip: ignore network with a netmask set to None
Browse files Browse the repository at this point in the history
For such netmask, the mask is 32 bits long per psutil docs and
  • Loading branch information
MatthieuDartiailh committed Dec 17, 2024
1 parent 09d461d commit 168ea89
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pyvisa_py/tcpip.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def list_resources() -> List[str]:
# Get broadcast address for each interface
for interface, snics in psutil.net_if_addrs().items():
for snic in snics:
if snic.family is socket.AF_INET:
if snic.family is socket.AF_INET and snic.netmask is not None:
addr = snic.address
mask = snic.netmask
network = ipaddress.IPv4Network(addr + "/" + mask, strict=False)
Expand Down

0 comments on commit 168ea89

Please sign in to comment.