[python-win32] Error while listing the Installed Software using wmi module

Tim Golden mail at timgolden.me.uk
Fri May 30 10:32:37 CEST 2008

siddhartha veedaluru wrote:
> Hi all,
> The following code snippet gives the error
> import wmi
> c = wmi.WMI()
> for i in c.Win32_Product():
>  print i.Name

WMI returns the Name as a unicode object.
You usually need to encode that one way or
another to print it out / save it to a file, etc.

Try this:

import wmi
c = wmi.WMI ()
for i in c.Win32_Product ():
  print i.Name.encode (sys.stdout.encoding, "replace")



More information about the python-win32 mailing list