-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Russell E. Owen Sent: Wednesday, March 29, 2006 1:55 PM
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). <snip> P.S. I'm going to be trying to figure out the same thing for unix and even Windows. I think I know how to do those, but if you happen to know or have sample code, that'd be great. ----------- On Windows, you can use sys.getwindowsversion, which will return something that looks like: (5, 1, 2600, 2, 'Service Pack 2') The first 3 values define the windows version; the fourth is generated by python code as a general NT vs CE vs ME identifier. Here's some sample code (table data cheerfully borrowed from the Inno Setup installer tool on Windows). ########################## import sys win_versions = { '4.0.950':'Windows 95', '4.0.1111':'Windows 95 OSR 2 & OSR 2.1', '4.0.1212':'Windows 95 OSR 2.5', '4.1.1998':'Windows 98', '4.1.2222':'Windows 98 Second Edition', '4.9.3000':'Windows Me', '4.0.1381':'Windows NT 4.0', '5.0.2195':'Windows 2000', '5.1.2600':'Windows XP', '5.2.3790':'Windows Server 2003', } version = win_versions["%d.%d.%d" % sys.getwindowsversion()[:3]] print version ########################## Note that this tool does NOT identify 64-bit versions of Windows (they'll show up as either XP or Server 2K3). I don't know how you'd do that. _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig