Detect Linux Runlevel

Wildman best_lay at
Mon Dec 5 22:27:10 EST 2016

On Mon, 05 Dec 2016 18:25:58 -0700, Michael Torrie wrote:

> I think Python is a good choice for such a utility, but I agree it is
> much better to rely on these external utilities as children to do the
> platform-dependent work, rather than try to re-implement everything in
> Python.  A long time ago I wrote a simple wrapper to Popen that would
> run a command and return the standard out and standard error to me.

My rational is that all Linux distros are not created equal.
One comes with one certain set of utilities and another can
have different ones.  I can't always depend on a given
utility being there.  And there is not way to know the
names of same utility across all distros.  This is especially
a problem when comparing .rpm with .deb based distros.

In cases where I have to use an external program, I mean in
cases where there is no apparent Python solution, I check
for the existence of that program and just skip over that
section of the code if it is not found.

BTW here is a link for the Bash script I mentioned in case
you would like to take a look at it.  The guy who wrote
it had only been learning Bash for a few months.  Not bad.
I have tried to tweak an interest in him for Python but
he sticks with Bash.  He says that is the best language
for programming on Linux and he is not interested in GUI

<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!

More information about the Python-list mailing list