> As per Stevens/Rago, "file and record locking provides a convenient > mutual-exclusion mechanism".
On linux (at least) there's one nice trick to get a single-instance program. Create a unix domain socket, and bind it to an address that begins with the null character '\0'. You can bind the same address a second time, and if the process dies the socket is automatically destroyed. It will not leave anything on the filesystem. def single_instance(id): import socket s = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) s.bind('\0' + id) return s -- дамјан ( http://softver.org.mk/damjan/ ) When you do things right, people won't be sure if you did anything at all. -- http://mail.python.org/mailman/listinfo/python-list