Couple of noobish question
digitig at gmail.com
Thu Feb 5 01:45:56 CET 2009
2009/2/5 <afriere at yahoo.co.uk>:
> On Feb 5, 11:14 am, Tim Rowe <digi... at gmail.com> wrote:
>> On an MS Windows system, os.uname() raises an AttributeError -- sys
>> doesn't seem to contain uname. Is that a Linux thing? Would os.name
>> work on Linux? Or would one have to use exception handling and catch
>> the Windows case?
> It seems to be a Windows thing. My Linux box gives me 'Linux' the
> server gives me 'SunOS' and a Mac tells me 'Darwin'. I'm still
> running Python2.4 on the Windows box. At least in that version on the
> OS, the 'os' module has no attribute 'uname', On both Linux and
> SunOS, os.name returns 'posix'.
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?
More information about the Python-list