Skip to content

Sysctl.value results AttributeError for non-str types #13

Description

@uyota

FreeBSD pkg version work okay

% pkg query '%n-%v' py37-freebsd-sysctl
py37-freebsd-sysctl-0.0.7
% python3
Python 3.7.9 (default, Feb 28 2021, 01:41:41)
[Clang 11.0.1 (git@github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c on freebsd13
Type "help", "copyright", "credits" or "license" for more information.
>>> from freebsd_sysctl import Sysctl
>>> a = Sysctl("kern.osrevision")
>>> print(a.value)
199506

However, latest version from github cannot print kern.osrevision:

/..../3rd-party/py-freebsd_sysctl
[py-venv] % pip install -e .
Obtaining file:///..../3rd-party/py-freebsd_sysctl
  Preparing metadata (setup.py) ... done
Installing collected packages: freebsd-sysctl
  Attempting uninstall: freebsd-sysctl
    Found existing installation: freebsd-sysctl 0.0.8
    Uninstalling freebsd-sysctl-0.0.8:
      Successfully uninstalled freebsd-sysctl-0.0.8
  Running setup.py develop for freebsd-sysctl
Successfully installed freebsd-sysctl-0.0.8
[py-venv] % python3
Python 3.7.9 (default, Feb 28 2021, 01:41:41)
[Clang 11.0.1 (git@github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c on freebsd13
Type "help", "copyright", "credits" or "license" for more information.
>>> from freebsd_sysctl import Sysctl
>>> a = Sysctl("kern.osrevision")
>>> print(a.value)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/..../3rd-party/py-freebsd_sysctl/freebsd_sysctl/__init__.py", line 105, in value
    return self.raw_value.value.strip("\n")
AttributeError: 'int' object has no attribute 'strip'
>>> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions