Dec-17-2018, 09:08 PM
It raises an exception at the first IP address that's not a network (p.s. f2 is defined before. It's the file. It contains either a username, IP address or IP address with a range. I want only the IP addresses and IP addresses with ranges.
Error:
Traceback (most recent call last):
File "E:\Data\Languages\French\test\block.py", line 20, in <module>
net = ipaddress.IPv4Network(line[2])
AttributeError: 'IPv4Address' object has no attribute 'IPv4Network'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Data\Languages\French\test\block.py", line 21, in <module>
except ipaddress.AddressValueError:
AttributeError: 'IPv4Address' object has no attribute 'AddressValueError'
Error:
Traceback (most recent call last):
File "E:\Data\Languages\French\test\block.py", line 20, in <module>
net = ipaddress.IPv4Network(line[2])
AttributeError: 'IPv4Address' object has no attribute 'IPv4Network'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Data\Languages\French\test\block.py", line 21, in <module>
except ipaddress.AddressValueError:
AttributeError: 'IPv4Address' object has no attribute 'AddressValueError'