I want to update my software on the fly, so my Pyinstaller-packaged
python program downloads a new version, then calls
os.spawnl(os.P_NOWAIT, my-installer, my-installer)
and exits. The installer fails because it cannot delete the
executable. Using handle.exe from
http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx
shows the called program has open handles to the caller:
listomaxinstall.exe pid: 1844 DELL420\phil
44: File (RW-) C:\Program Files\Listomax\Listomax.exe
CC: File (RW-) C:\Program Files\Listomax\Listomax.exe
144: File (RW-) C:\Documents and Settings\phil\Application Data
\Listomax\phil1
...etc.
Environment is Windows XP SP2. To reproduce this, package the
following 3-line python program, then attempt to delete the executable
while notepad is still open. The delete will fail.
import os
dst = r'C:\windows\system32\notepad.exe'
os.spawnl(os.P_NOWAIT, dst, dst)
For comparison, I tried spawnl from a C program; it does not have the
same problem.
I know this is somewhat obscure, and it's not a show-stopper, but if
anyone has any clues, I'd appreciate it. Thanks, Phil