[Pythonmac-SIG] How to get MacOS X version?

Russell E. Owen rowen at cesmail.net
Thu Mar 30 02:18:36 CEST 2006

In article <ADB6B9D0-5D12-4495-B2B4-65E0291204E5 at redivi.com>,
 Bob Ippolito <bob at redivi.com> wrote:

> On Mar 29, 2006, at 10:54 AM, Russell E. Owen wrote:
> > How can I get the version of MacOS X within a python program?
> > (e.g. 10.4.5 -- something that is recognizable, rather than the kernel
> > version)....
> platform.mac_ver() -- this is almost definitely broken on Python  
> 2.3.5 on Intel though, because Carbon.* and gestalt are mostly broken  
> there.  The reliable way that has always and should always work is to  
> parse either /usr/bin/sw_vers or /System/Library/CoreServices/ 
> SystemVersion.plist.

Thank you very much! I had just found platform.py via google and was 
starting to study it, but didn't realize it was part of the standard 
library until I got your email.

I'm also glad to know gestalt exists. (I had looked for that, but it's 
not listed in the global module index.)

Also thanks to Kent Quirk for the handy Windows code.


-- Russell

More information about the Pythonmac-SIG mailing list