From 817293f66900a31ea1a53355ee46eba039cdd247 Mon Sep 17 00:00:00 2001 From: "Fredrick W. Warren" Date: Mon, 30 May 2022 20:49:11 -0700 Subject: [PATCH] added pyinstaller find current folder --- hcatitles.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hcatitles.py b/hcatitles.py index 9b86855..73852b9 100644 --- a/hcatitles.py +++ b/hcatitles.py @@ -1,8 +1,16 @@ +import os import PySimpleGUI as sg from PIL import Image, ImageDraw, ImageEnhance, ImageFilter, ImageFont, ImageOps from io import BytesIO -# Globals + +def resource_path(relative_path): + """ Get absolute path to resource, works for dev and for PyInstaller """ + try: + base_path = sys._MEIPASS + except Exception: + base_path = os.path.abspath(".") + return os.path.join(base_path, relative_path) def update_image(original, title, subtitle):