import os import sys def resource_path(relative_path: str) -> str: # https://stackoverflow.com/a/13790741 try: base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") with open('/Users/matt/devel/gemini-client/applog.txt', 'w') as fp: fp.write(os.path.join(base_path, relative_path)) return os.path.join(base_path, relative_path)