I'm not the author of netifaces, I just added the project on github and I added a spec file to build the RPM package for the basic Amazon Linux AMI 2012.03
35
stars
10
forks
source link
Issue with examples on a mac - I incorrectly attached this issue to the Raspberry Pi issue - Please ignore that one #5
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
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'](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 [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?
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
In [15]: gws=netifaces.gateways In [16]: gws['default'][netifaces.AF_INET]
TypeError Traceback (most recent call last)