2009/2/5 <afri...@yahoo.co.uk>: > On Feb 5, 11:14 am, Tim Rowe <digi...@gmail.com> wrote: > > ... > >> On an MS Windows system, os.uname()[0] 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? -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list