Module for generic platform information: platform.py

M.-A. Lemburg mal at lemburg.com
Thu Oct 28 04:47:34 EDT 1999


Karl Putland wrote:
> 
> Try this on for size
> 
> Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> IDLE 0.5 -- press F1 for help
> >>> from win32api import RegOpenKeyEx, RegQueryValueEx
> >>> from win32con import HKEY_LOCAL_MACHINE
> >>> from win32api import RegEnumValue
> >>> key = RegOpenKeyEx(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Windows
> NT\CurrentVersion')
> >>> i=0
> >>> while 1:
>         try:
>                 str,obj,type = RegEnumValue(key,i)
>                 print str,obj,type
>                 i=i+1
>         except:
>                 break
> 
> SoftwareType SYSTEM 1
> InstallDate 934559805 4
> RegisteredOwner Administrator 1
> RegisteredOrganization wisen.com, Inc. 1
> CurrentBuild 1.511.1 () (Obsolete data - do not use) 1
> CurrentVersion 4.0 1
> CurrentBuildNumber 1381 1
> CurrentType Uniprocessor Free 1
> SystemRoot C:\WINNT 1
> SourcePath C:\I386\ 1
> PathName C:\WINNT 1
> ProductId 13299OEM004225197031 1
> CSDVersion Service Pack 4 1
> Plus! VersionNumber IE 5 5.00.2314.1003 1
> >>>
> 

Thanks, I'll try to come up with a function that does the above
and returns the data in a platform.py compatible tuple format.
It will only work on machines with MarkH's win32 package installed,
but it's definitely better than having windows pop up :-)

Is there a way to directly extract a certain key from the registry ?
I'd need the values of the keys 'CSDVersion', 'CurrentVersion' and
'CurrentBuild'. Plus perhaps 'CurrentType' if someone could enlighten
me with a suitable interpretation ;-) ... 'Uniprocessor Free' sounds
somewhat strange.

Thanks,
-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                    64 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/






More information about the Python-list mailing list