What about checking the interface before trying to access its data with something like:
if $TAPBR in netifaces.interfaces():
print netifaces.AF_INET in netifaces.ifaddresses('$TAPBR')
else:
print False
I don't like much catching exceptions for conditions that can be checked before accessing
some invalid value.
What about checking the interface before trying to access its data with something like: interfaces( ): ifaddresses( '$TAPBR' )
if $TAPBR in netifaces.
print netifaces.AF_INET in netifaces.
else:
print False
I don't like much catching exceptions for conditions that can be checked before accessing
some invalid value.