Couple of noobish question

afriere at yahoo.co.uk afriere at yahoo.co.uk
Wed Feb 4 20:44:41 EST 2009


On Feb 5, 11:45 am, Tim Rowe <digi... at gmail.com> wrote:


[snip]

> Python in a Nutshell states that os.uname "exists only on certain
> platforms", and in the code sample wraps it in a try statement. That
> seems to be the safe way to go -- except (and I don't know much about
> this) wouldn't code have to be digging into some pretty obscure
> corners to find a difference between different posix implementations?

Perhaps not, if the particular posix implementation is Mac OSX.  I
would think that trying os.uname() first and then os.name if it throws
will give you the clearest picture of which OS you are facing.
Alternatively you could query os.name and if that says 'posix' proceed
to call os.uname().



More information about the Python-list mailing list