I changed my app to run as a daemon but then the temporary
(_MEIXXXXX) directory disappeared as soon as the child and grandchild
are spawned and the parent terminates.
My solution is to change the permission on the temp directory in the
parent. I remove write access so the parent can't remove the
directory.
current_tmp_dir = os.path.dirname( os.environ['_MEIPASS2'] )
os.chmod(current_tmp_dir, stat.S_IREAD|stat.S_IEXEC)
I don't bother removing the directory when the daemon (grandchild)
exits. Instead I have the daemon check for all temporary directories
in it's initialization code and remove all but the one that is
currently in use. I just need to add write access in order to allow
removal of the directories.
tmp_dir_list = [os.path.dirname(x)
for x in os.popen('ls /tmp/_MEI*/cPickle.so 2>/dev/
null').read().split()]
tmp_dir_list.remove(current_tmp_dir)
for d in tmp_dir_list:
os.chmod(d, stat.S_IREAD|stat.S_IWRITE|stat.S_IEXEC)
shutil.rmtree(d, ignore_errors=True)
Good enough?
--
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.