I've been using Py2app for a few weeks now to create DIST builds for my application. It has worked fine so far but now I'm trying to include images within my application that won't be available on other people's computers. I've tried tweaking my setup.py file so that when it's building the correct files will be placed in the resource folder but it's still not working. I suspect it's because I have my setup file configured incorrectly. Here it is.
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
APP = ['AccuAdmin2.0.py']
DATA_FILES = [('', ['Project_Images'])]
OPTIONS = {'argv_emulation': True}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
The 'Project_Images' refers to a folder that I created in my PycharmProject -> AccuAdmin2.0 directory folder. In it there contains a single jpg. Any ideas? Much appreciation.
I figured this out. I forgot to change the file paths of the images within the actual py file that I was converting to an app. I changed the path to be something like Project_Images/something.jpg so
Image.open("Project_Images/something.jpg")
and then in my setup.py file I made the following edit
DATA_FILES = [('', ['Project_Images'])]
Which I believe basically says include everything within that directory when creating the app. Just a heads up for anyone having a similar problem as me. It's very simple once you've figured it out.