>> import procfs
>> s = procfs.sysctl()
>> s.refresh()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/procfs/sysctl.py", line 64, in refresh
for key in self.cache():
TypeError: 'dict' object is not callable
>>
[root@localhost ~]# pushd
/usr/lib/python3.6/site-packages/
/usr/lib/python3.6/site-packages ~
[root@localhost site-packages]# patch -i /home/indy/0001-sysctl-Fix-refreshing-cache.patch
-p1
patching file procfs/sysctl.py
[root@localhost site-packages]# python3
Python 3.6.7 (default, Nov 23 2018, 12:11:28)
[GCC 8.2.1 20181105 (Red Hat 8.2.1-5)] on linux
Type "help", "copyright", "credits" or "license"
for more information.
>> import procfs
>> s = procfs.sysctl()
>> s.refresh()
>>>
[root@localhost site-packages]# popd
~
[root@localhost ~]# pushd /usr/lib/python2.7/site-packages/
/usr/lib/python2.7/site-packages ~
[root@localhost site-packages]# patch -i /home/indy/0001-sysctl-Fix-refreshing-cache.patch
-p1
patching file procfs/sysctl.py
[root@localhost site-packages]# python2
python2 python2.7 python2.7-config python2.7-futurize
python2.7-pasteurize python2-config
[root@localhost site-packages]# python2.7
Python 2.7.15 (default, Oct 15 2018, 15:24:06)
[GCC 8.1.1 20180712 (Red Hat 8.1.1-5)] on linux2
Type "help", "copyright", "credits" or "license"
for more information.
>> import procfs
>> s = procfs.sysctl()
>> s.refresh()
>>>
applying
On Fri, Jan 11, 2019 at 03:24:00PM +0100, Ondřej Lysoněk wrote:
> Fix iterating over the 'cache' dictionary in refresh(). A dictionary is
> not callable. This fixes the following error:
>
> >>> import procfs.sysctl
> >>> s = procfs.sysctl()
> >>> s.refresh()
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python3.6/site-packages/procfs/sysctl.py", line 64, in
refresh
> for key in self.cache():
> TypeError: 'dict' object is not callable
>
> Signed-off-by: Ondřej Lysoněk <olysonek(a)redhat.com>
> ---
> procfs/sysctl.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/procfs/sysctl.py b/procfs/sysctl.py
> index 8b256ab..6a91455 100755
> --- a/procfs/sysctl.py
> +++ b/procfs/sysctl.py
> @@ -61,7 +61,7 @@ class sysctl:
> f.close()
>
> def refresh(self):
> - for key in self.cache():
> + for key in self.cache.keys():
> del self.cache[key]
> value = self.read(key)
> if value != None:
> --
> 2.17.2
>