On gio, 2007-10-18 at 06:38 -0700, Anton wrote: > Is there a way to have the python modules not be in the exe, but in an > external file (or several)?
Not out of the box, but try the following: - Generate a one-dir spec file through Makespec. - Edit it: in the EXE line, you should see it adding the pyz to the executable. Remove it. This prevents the .pyz from being added. - Add the pyz to the COLLECT process, so that it gets copied into the dist. If you now run Build.py and look into the dist directory, you should see the small executable and the external pyz file. You may need to rename the pyz file (specify a name= argument to the PYZ() call). - Prepare a small script called something like _bootstrap.py. The script contains something like: import sys sys.path.insert(0, "foobar.pyz") You may want to add the absolute path, but you can only import builtin modules from this file (so "sys" is ok, but "os" is not ok; but you can import "nt" which contains the guts of "os" and cut & paste some code from os.py). - Add _bootstrap.py to your spec file in the list of script files *before* _mountzlib.py (which is PyInstaller's own bootstrap script). That should be it. I can see another possible failure point: maybe the bootloader assumes there always is a PYZ file attached to the executable (even if empty). In that case, try creating an empty PYZ in the spec file (just call PYZ() with as few arguments as possible) and add it to the EXE. Notice that there will *always* be a PKG file attached to the executable; you can't help this, because it will contain stuff needed for bootstrap (like _mountzlib, and internal PyInstaller modules like iu, ecc.). But if you succeed in having your big .pyz file external, you can try closing the executable before starting the actual program. > When the python modules are in the exe, The running program will open > itself (the binary exe of the process). This has some side effects on > Windows which are causing me problems. > > First, an exe that opens itself cannot be removed or even renamed > while the program is running. This sometimes causes problems with the > Microsoft Installer (MSI). If a file cannot be removed MSI will > attempt to move it, which will succeed on program binaries that don't > open themselves for reading. > > Second, some anti-virus products seem to get seriously confused by > pyinstaller programs. Here I am not certain that it is exactly this > "program opening its own binary" that is the culprit, but it is > something special with pyinstaller programs that causes problems: I > have a windows service made using pyinstaller. On some Windows XP > machines it does not start within the 30 seconds given to it by > Service Control Manager. When the anti-virus software is uninstalled, > the service always starts. I'm unconvinced by any of these arguments. I believe that your problems are not caused by PyInstaller opening its executable, but hey I might be wrong :) -- Giovanni Bajo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "PyInstaller" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/PyInstaller?hl=en -~----------~----~----~----~------~----~------~--~---
