Bundle Text File In Py2app Application (python)
Solution 1:
Specify a resources key in your options that contains a list of resources to include. This will be the current directory when your app runs
options = { "resources": ["myfile.txt"] }
http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html#option-reference
If you use the resources flag with py2applet it will creates that key
Solution 2:
From the help document for py2app:
The first step is to create a
setup.pyfile for your script.setup.pyis the "project file" that tells setuptools everything it needs to know to build your application. We'll use thepy2appletscript to do that:
$ py2applet --make-setup MyApplication.py
Wrote setup.pyIf your application has an icon (in .icns format) or data files that it requires, you should also specify them as arguments to
py2applet.
So presuming you have hangman.py and hangman.txt run:
$ py2applet --make-setup hangman.py hangman.txt
Solution 3:
A very simple way is to add your dictionary as a (variable in a) python module that you import at run time. The dictionary will be embedded in your exe as any other module.
Post a Comment for "Bundle Text File In Py2app Application (python)"