[Pythonmac-SIG] obtaining versions of application bundles

brad.allen at omsdal.com brad.allen at omsdal.com
Fri Oct 22 02:00:44 CEST 2004


I'm looking for a good way to obtain the versions of Mac OS X application
bundles. The osascript/Applescript approach has serious problems, because
sometimes the Finder isn't running.

The info.plist file in the application bundle usually contains version
info. However, I'm not sure I want to get into parsing plists. Is this the
best approach, or is there a way to do it using native APIs?

Thanks for any help or ideas on this!

(here is my test attempt to obtain a version of an application bundle using
the Applescript approach--various bad things happened when run via ssh on a
Mac sitting at the login prompt)

import subprocess

#determine the version of Timbuktu, as an example
appleScript = """
tell application "Finder"
      version of file "Applications:Timbuktu Pro:Timbuktu Pro" of startup
disk
end tell
"""

PIPE = subprocess.PIPE
args = ('osascript','-e',appleScript)
child =
subprocess.Popen(args,executable='/usr/bin/osascript',stdin=PIPE,stdout=PIPE,stderr=PIPE)
version = child.stdout.read()
print version



More information about the Pythonmac-SIG mailing list