how to determine Operating System in Use?

Ian F. Hood IanFHood at gmail.com
Wed Dec 13 23:08:18 EST 2006


I am integrating with an existing cross-platform system that provides 
different shell scripts and/or batch files for each environment.  Normally 
the selection is performed manually but my utility needs to automate this. 
To select the correct utility I need to know what platform my code is 
running on.

"Paul Watson" <pwatson at redlinepy.com> wrote in message 
news:4ubttfF17m7vaU1 at mid.individual.net...
> 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.
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 






More information about the Python-list mailing list