From: E. A. T. <e.a...@te...> - 2004-06-18 09:35:47
|
In Friday, June 18, 2004, 6:13:29 AM, Bruno wrote: BS> Hi all, BS> I've developped a small application in Python and, I'm trying to use BS> py2exe to convert it into an executable. BS> My application has a root directory where the main script is along with BS> a few others. Then, when executed it loads all the ".py" or ".pyc" BS> files stored in module "pool" from the root directory. The idea is that BS> later on, other users can extend future files that will be used by the BS> main application stored in the root directory. BS> When converted into an executable, somehow I'm no longer able to load BS> the .py files from module pool. I've tryed several ways, but with no BS> success. BS> Here is my setup.py configuration: BS> # setup.py BS> from distutils.core import setup BS> import py2exe BS> setup( BS> version = "0.3.5", BS> author="Bruno Santos ", BS> author_email="bm...@gm...", BS> # targets to build BS> console = ["beefBuilder.py"], BS> scripts = ["Node.py", BS> "DataNode.py", BS> "datanodegui.py", BS> "gui.py" ], BS> data_files=[("images", ["images/BeefBuilder.ico", BS> "images/add-arrow.bmp", BS> "images/add-node.bmp", BS> "images/subtract.bmp", BS> "images/struct-a-file.gif", BS> "images/export.bmp", BS> "images/new.bmp", BS> "images/open.bmp", BS> "images/save.bmp", BS> "pool/classnode.py", BS> "pool/switchnode.py"]) ], BS> ) BS> Any idea why? BS> Regards, I once needed this and I used glob to do the trick (via py2exe 0.4; I can't precise if that's still valid for the current version). Importing glob and changing your data_files to look something like this may help: # file setup.py [...] import glob [...] data_files=[("images", ["images/BeefBuilder.ico", "images/add-arrow.bmp", "images/add-node.bmp", "images/subtract.bmp", "images/struct-a-file.gif", "images/export.bmp", "images/new.bmp", "images/open.bmp", "images/save.bmp"]), ("pool", glob.glob("pool/*.py*"))] [...] -- tacao |