Detect Linux Runlevel

Wildman best_lay at yahoo.com
Mon Dec 5 23:26:54 EST 2016


On Mon, 05 Dec 2016 20:46:22 -0700, Michael Torrie wrote:

> On 12/05/2016 08:27 PM, Wildman via Python-list wrote:
>> 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.
> 
> Well this is a problem regardless of which scripting language you choose
> and the solutions will be the same.

It is a problem only if you depend on the utility.

> Personally for a script of this type, I'd probably stick with Bash
> myself.

In most cases I would agree with that, but, in this case my
goal is learning Python.  I did write a couple of programs
with Bash several months ago to learn a little about it.
One will take an image and convert it into an X-Face header
and the other will take an image and convert it into a Face
header.  I later wrote GUI versions of the programs with
Python and Tkinter.

BTW, I don't depend on programming for a living.  I would be
in bad shape if I did.  It is a hobby that I greatly enjoy.
And, being in my later years, it keeps my mind sharp(er).

> Which by the way is what inxi is written in.

Yes, I was aware of that.  It's over 12,000 lines!

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



More information about the Python-list mailing list