1

In python how can I get the value of the sysctl kern.module_path?

I know I can use popen to open sysctl(1) as a subprocess. Is there a better way?

1 Answers1

2

I think your best bet is the sysctl library: https://pypi.python.org/pypi/sysctl/0.1b2

Alternatively, you could use ctypes to interface directly with the C library. There's already a stackoverflow answer with an example of how to read sysctl values here: python ctypes and sysctl

(Obviously, if you wanted to set values, you would have to modify that ctypes example a little).

Community
  • 1
  • 1
hetman
  • 919
  • 6
  • 16