Windows mutex to prevent multiple instances

Hans Nowak wurmy at
Thu Aug 29 02:31:15 CEST 2002

Samuel Bronson wrote:

>   Use a lock file, you could call it '' and put the pid of your 
> app in it so it can serve double-duty.

We considered using a file to mark that the program is running, but dismissed 
the idea because of the problems this method caused in other apps we've seen... 
file doesn't get deleted, etc.

>   Obviously, you will need to have a path for it if you want it to 
> actually work.
>   You may also wish to consider why it is so important that only one 
> instance exist at a time.

It is important because the programs query the database, then write some stuff 
back; running it multiple times simultaneously can (and obviously will, as we 
have found) result in undesirable duplicate records.

Hans (base64.decodestring('d3VybXlAZWFydGhsaW5rLm5ldA=='))
# decode for email address ;-)
The Pythonic Quarter::

More information about the Python-list mailing list