How do I force a single instance of a python app?
Dale Strickland-Clark
dale at out-think.NOSPAMco.uk
Wed Oct 25 09:45:17 EDT 2000
More information about the Python-list mailing list
Wed Oct 25 09:45:17 EDT 2000
- Previous message (by thread): makepy error messages broken in win32all build 135
- Next message (by thread): How do I force a single instance of a python app?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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. "Joshua Muskovitz" <josh at open.com> wrote: >I need to prevent multiple copies of a python app from running >simultaneously on a single machine. In Windows and C++, this is done with >sending custom window messages to all top level windows, or using some other >kind of scheme. > >I'm looking for a platform neutral way to do this for my python apps -- the >second instance should somehow detect the first instance and should quietly >kill itself. It does not need to notify the first instance of anything. >Initial target platforms are Solaris and NT, but others will follow, so a >generic solution would be the best. File existence is a bad solution >because the first instance might (possibly) terminate before it could delete >the file. I need a semaphore which will absolutely go away when the first >instance dies, or else a way to reliably probe to see if the first instance >exists on the fly. > >Suggestions gratefully accepted! > >-- josh > > > > >-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- >http://www.newsfeeds.com - The #1 Newsgroup Service in the World! >-----== Over 80,000 Newsgroups - 16 Different Servers! =----- Dale Strickland-Clark Out-Think Ltd Business Technology Consultants
- Previous message (by thread): makepy error messages broken in win32all build 135
- Next message (by thread): How do I force a single instance of a python app?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list