From: <ak...@po...> - 2005-04-20 21:32:35
|
Hello everyone, I'm very new to py2exe although I have been using Gordon McMillan's Installer for years. I have a Python/Tkinter/Pmw application which has been verified under Unix and I want to port to Windows using py2exe. (Users in Windows may not have Python installed such that the application must be "self-sufficient") The application is nothing special except it uses a package which a user of the program is maintaining. At a startup, the program checks the package directory and recognizes the modules in the package. <directory structure> ./prog.py ./a_pkg ./a_pkg/__init__.py (empty file) /foo.py (user's file) /bar.py (user's file) /zot.py (user's file) A module in the package is imported using exec exec ('a_pkg.%s' % module_name) To enumerate the modules, I used path=a_pkg.__path__ then os.listdir(path[0]). I want to create an executable of the program excluding the a_pkg and below. The program tries to import a_pkg/foo.py, for example, from a user directory not from a zipped file. // First I thought I could use "--exclude" option people mentioned in the Internet. But it only excludes .pyd, .dll files. When I run the generated executable, it try to search the directory inside the libary.zip file (which is impossible). How can I exclude the package from the "frozen" dist. There is one more question. Assuming I could achieve the above, I still have another problem. "import" only looks for certain directory locations. Because of that, my program won't work unless the program find "a_pkg" directory. But how can I set the Python search path if there is no Python installation to begin with. // Any suggestions, comments are greatly appreciated. And, thank you for providing such wonderful software to Python community (otherwise, Windows is a useless platform to me). Best regards, Aki Niimura |