def get_prefix(): frozen = getattr(sys, "frozen", None) if frozen == "macosx_app" or "Zenmap.app" in sys.executable: # A py2app .app bundle. return os.path.join(dirname(fs_dec(sys.executable)), "..", "Resources") elif frozen is not None: # Assume a py2exe executable. return dirname(fs_dec(sys.executable)) else: # Normal script execution. Look in the current directory to allow # running from the distribution. return os.path.abspath(os.path.dirname(fs_dec(sys.argv[0])))