how to determine Operating System in Use?

Paul Watson pwatson at redlinepy.com
Wed Dec 13 22:14:55 EST 2006


Ian F. Hood 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

The more significant question is "why" do you want to do this?  Are you 
writing an asset management tool?  Do you just want to tell the user 
what operating system they are using?  The reason may lead to a 
different solution.



More information about the Python-list mailing list