1 try: 2 import pkg_resources 3 version = pkg_resources.require("cabot")[0].version 4 except Exception, ImportError: 5 version = 'unknown'