Thank you for the help and advice!
On Nov 6, 10:10, Giovanni Bajo wrote:
> Not out of the box, but try the following:
Thanks for the instructions, it worked just as you said.
> 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.
Yes, without a PYZ in the EXE I got:
Extracting binaries
S:\tmp\distfoo\python24.dll
Manipulating evironment
PYTHONPATH=S:/tmp/distfoo
importing modules from CArchive
Installing import hooks
Running scripts
Traceback (most recent call last):
File "<string>", line 17, in ?
ImportError: No module named archive
RC: -1 from _mountzlib
OK.
But, with the dummy PYZ you suggested it worked fine.
> 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.
OK, I got the external PYZ file working. I tried to close the open exe
using os.close(fd) from the python program. There was a file
descriptor 3 that I closed. Oddly enough, closing it did not release
the file so that it could be renamed in windows. See the example below
on how closing does work with standard python.
> > 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
> > [...]
> 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 :)
Yes, the anti-virus stuff was pure speculation. However, I have
studied the file deletion and renaming and MSI part a bit and that is
for real. I have a workaround for my setup, but this still bugs me.
Here is a demonstration of how Windows works:
If a process does not open its own executable:
C:\Python24>copy python.exe foo.exe
C:\Python24>foo.exe
in another shell:
C:\Python24>del foo.exe
C:\Python24\foo.exe
Access is denied.
C:\Python24>ren foo.exe bar.exe
---> NO ERROR
If a process does open its own executable:
C:\Python24>copy python.exe foo.exe
C:\Python24>foo.exe
>>> f = open("foo.exe", "r")
C:\Python24>del foo.exe
C:\Python24\foo.exe
The process cannot access the file because it is being used by
another process.
C:\Python24>ren foo.exe bar.exe
The process cannot access the file because it is being used by
another process.
# You can see how this can be an issue during software upgrade when
you want to replace the exe.
>>> f.close()
C:\Python24>del foo.exe
C:\Python24\foo.exe
Access is denied.
C:\Python24>ren foo.exe bar.exe
---> NO ERROR
The same effect I get when closing with os.close(f.fileno()).
However, when I try something seemingly equivalent with the external
PYZ, and closing all file descriptors > 2, I still get the
>ren foo.exe bar.exe
The process cannot access the file because it is being used by
another process.
Strange.
If I wished to experiment with having pyinstaller not opening its
executable at all, I guess I would then have to hack the loader to try
to open another file for accessing the archive?
Thank you for helping out, I really appreciate it!
Anton
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---