How to find Firefox version using python?
                +2 
                A: 
                
                
              Try the following code snippet:
import os
firefox_version = os.popen("firefox --version").read()
                  Alan Haggai Alavi
                   2009-06-19 06:39:53
                
              os.popen() - Deprecated since version 2.6: This function is obsolete. Use the subprocess module.
                  gimel
                   2009-06-19 06:56:22
                
                +1 
                A: 
                
                
              
            I tried Alan's code snippet and it didn't work for me. One problem with it is that in order for the "-v or -version" flags to work, you must have a debug version firefox. See here under "Miscellaneous" for details.
Try the following, which uses the win32 library to read the Product Version string directly from the .exe file:
import win32api
def get_version(filename):
    info = win32api.GetFileVersionInfo(filename, "\\")
    ms = info['ProductVersionMS']
    ls = info['ProductVersionLS']
    return win32api.HIWORD(ms), win32api.LOWORD(ms), win32api.HIWORD(ls), win32api.LOWORD(ls)
if __name__ == '__main__':
    print ".".join([str (i) for i in get_version(r"C:\Program Files\Mozilla Firefox\firefox.exe")])
                  ReadySquid
                   2009-06-21 22:05:49