Possible duplicate:
Python: one instance of the program
What is the best way to ensure that only one copy of a python script works? I'm having problems with zombie pythons. I'm tired of creating a write lock with open("lock","w"), but python doesn't notify me if the file already has a write lock, it just seems to be waiting.
source
share