I have the following code (I removed the watermark_text function because I know it does its job). The code works fine when running on Terminal as a .py script but if I build an executable with pyinstaller (on Mac OS) it keeps working if I run it from terminal but when I double-click it from finder something goes wrong and no exception is shown. If the folders DIR and OUD_DIR don’t exist the os.mkdir function won’t create them and if the folders exist os.listdir won’t find any file. What’s the issue here? I tried pyinstaller on Windows on the same code and it works perfectly. What am I missing?
DIR: Final[str] = "Images/"
OUT_DIR: Final[str] = "WMImages/"
LOGO: Final[str] = "logo.png"
if not os.path.exists(DIR):
os.mkdir(DIR)
if not os.path.exists(OUT_DIR):
os.mkdir(OUT_DIR)
image_list = os.listdir(DIR)
wm_image_list = os.listdir(OUT_DIR)
for img in image_list:
image_file = Image.open(DIR + img)
new_image = watermark_text(image_file)
new_image.save(OUT_DIR + img)