eeps! typo. > if sys.platform == "darwin": > macStuff() > elif sys.platform == "win32": > winStuff() >
Not sure what the string is on linux. Just fire up the interpreter and try it. Prateek Prateek wrote: > also try: > > sys.platform > > if sys.platform == "darwin": > macStuff() > elif sys.platform == "win32": > linuxStuff() > > > James Cunningham wrote: > > On 2006-12-13 19:28:14 -0500, [EMAIL PROTECTED] said: > > > > > > > > > > > On Dec 13, 6:32 pm, "Ian F. Hood" <[EMAIL PROTECTED]> wrote: > > >> Hi > > >> In typically windows environments I have used: > > >> if 'Windows' in os.environ['OS']... > > >> to prove it, but now I need to properly support different environments. > > >> To do so I must accurately determine what system the python instance is > > >> running on (linux, win, mac, etc). > > >> Is there a best practises way to do this? > > >> TIA > > >> Ian > > > > > > I would do this: > > > -------------------- > > > if os.name == ''posix': > > > linuxStuff() > > > elif os.name == 'nt': > > > windowsStuff() > > > elif os.name == 'os2': ... > > > ------------------- > > > os.name is 'posix', 'nt', 'os2', 'mac', 'ce' or 'riscos' > > > > > > -N > > > > Bearing in mind, of course, that Mac will return "posix", too. And > > Cygwin might. Erg. > > > > Best, > > James -- http://mail.python.org/mailman/listinfo/python-list