How do I force a single instance of a python app?

Mark Hammond MarkH at ActiveState.com
Wed Oct 25 20:15:07 EDT 2000


"Dale Strickland-Clark" <dale at out-think.NOSPAMco.uk> wrote in message
news:urodvssp7e7cmbv1ljlqnqgej9rjhfqbli at 4ax.com...
> Open a flag file exclusively for writing. If successful you are
alone,
> if not, another instance already has the file.
>
> The OS should close the file and free the exclusive lock if the app
> crashes.

Or attempt to create a directory - that is an atomic operation that
indicates what you need to know.  Obviously will need some sort of
recovery options or process tho...

Mark.





More information about the Python-list mailing list