[PyQt] Detecting second copy of program in memory.[SOLVED]

David Klasinc bigwhale at lubica.net
Wed Jun 11 19:57:35 BST 2008


Igor Prischepoff wrote:

> Hello, I have found solution for my problem.
> So this post only for archiving in email list.
>   Attaching example is a python version of this solution:
> http://wiki.qtcentre.org/index.php?title=SingleApplication
> 
>   It is possible to detect second instance of application and to send 
> some string to it (sys.argv in my case).
> Thanks to all who answered my questions in this list!

My detection code is pretty simple:

  shMem = QtCore.QSharedMemory ("pyEVE - Shared Memory Check")
  if not shMem.create (10):
      print "Already running!"
      sys.exit (1)



Regards,
David


More information about the PyQt mailing list