-
Notifications
You must be signed in to change notification settings - Fork 9
Description
I am getting the following error while using iPython (Python 3.6.3 (v3.6.3:2c5fed86e0, Oct 3 2017, 00:32:08)) in a terminal window on a mac running Sierra and implementing the following example:
For convenience, we also allow you to index the dictionary with the special value 'default', which returns a dictionary mapping address families to the default gateway in each case. Thus you can get the default IPv4 gateway with
gws = netifaces.gateways()
gws['default'][netifaces.AF_INET]
('10.0.1.1', 'en0')
The results from this test - I tried replacing "[]" with "()" in different combinations but get errors as follows:
In [15]: gws=netifaces.gateways
In [16]: gws['default'][netifaces.AF_INET]
TypeError Traceback (most recent call last)
in ()
----> 1 gws['default'][netifaces.AF_INET]
TypeError: 'builtin_function_or_method' object is not subscriptable
In [17]: gws['default'][netifaces.AF_INET]
TypeError Traceback (most recent call last)
in ()
----> 1 gws['default'][netifaces.AF_INET]
TypeError: 'builtin_function_or_method' object is not subscriptable
In [18]: gws('default')[netifaces.AF_INET]
TypeError Traceback (most recent call last)
in ()
----> 1 gws('default')[netifaces.AF_INET]
TypeError: gateways() takes no arguments (1 given)
In [19]: gws'default'
TypeError Traceback (most recent call last)
in ()
----> 1 gws'default'
TypeError: 'builtin_function_or_method' object is not subscriptable
In [20]: gws('default')(netifaces.AF_INET)
TypeError Traceback (most recent call last)
in ()
----> 1 gws('default')(netifaces.AF_INET)
TypeError: gateways() takes no arguments (1 given)
Is there a solution to this issue?