Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What program could I use to get a list of installed software using Python for cross platform or at least Windows or Mac? Please check the code which i googled, but am getting some errors. I am using Python 2.7, win 7 64 bit, eclipse

import StringIO
import traceback    
import wmi
from _winreg import (HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS, 
                     OpenKey, EnumValue, QueryValueEx)

softFile = open('softLog.log', 'w')
errorLog = open('errors.log', 'w')

r = wmi.Registry ()
result, names = r.EnumKey (hDefKey=HKEY_LOCAL_MACHINE, sSubKeyName=r"Software\Microsoft\Windows\CurrentVersion\Uninstall")

softFile.write('These subkeys are found under "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall"\n\n')
separator = "*" * 80
keyPath = r"Software\Microsoft\Windows\CurrentVersion\Uninstall"

for subkey in names:
        softFile.write(separator + '\n\n')
        path = keyPath + "\\" + subkey
        key = OpenKey(HKEY_LOCAL_MACHINE, path, 0, KEY_ALL_ACCESS) 
            temp = QueryValueEx(key, 'DisplayName')
            display = str(temp[0])
            softFile.write('Display Name: ' + display + '\nRegkey: ' + subkey + '\n')
            softFile.write('Regkey: ' + subkey + '\n')

        fp = StringIO.StringIO()
        errorMessage = fp.getvalue()
        error = 'Error for ' + key + '. Message follows:\n' + errorMessage

softFile.close()/* files are empty*/

Error displayed in console:

Traceback (most recent call last):
  File "C:\Users\Administrator\EclipseWorkspace\Aug28th2012\PythonDevelopment\src\TestClass\", line 21, in <module>
    result, names = r.EnumKey (hDefKey=HKEY_LOCAL_MACHINE, sSubKeyName=r"Software\Microsoft\Windows\CurrentVersion\Uninstall")
  File "C:\Python27\lib\site-packages\", line 431, in __call__
    handle_com_error ()
  File "C:\Python27\lib\site-packages\", line 241, in handle_com_error
    raise klass (com_error=err)
wmi.x_wmi: <x_wmi: Unexpected COM Error (-2147352567, 'Exception occurred.', (0, u'SWbemProperty', u'Type mismatch ', None, 0, -2147217403), None)>
share|improve this question

migrated from Sep 4 '12 at 10:11

This question came from our site for professional and enthusiast programmers.

Hi! Welcome to StackOverflow. In general, requests for code are usually poorly received unless some prior effort is demonstrated. Can you post any code you've written so far that we can help you with? Have you tried Googling, and if so, what kinds of information have you found? – Michael0x2a Sep 3 '12 at 6:24
What do you mean by installed software? Applications in Installed Programs (for Windows) or Applications (for Macs)? Are you including command-line commands? – David Robinson Sep 3 '12 at 6:27

Installed software concept is not well-defined, as on Windows the application installation process is free form on non-closed platforms (iOS, Android).

Possible options

  • Read Installed applications using Windows API

  • List folders in C:\Program Files

  • On OSX "installed application" is the content of the folder /Applications

If you want to check for a specific application then read its related installation entry (application specific) from Windows registry.

share|improve this answer
I want to write the code to chk for installations – user1617707 Sep 3 '12 at 6:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.