testing if another instance of a script is already running

skip at pobox.com skip at pobox.com
Sat Sep 13 18:34:07 EDT 2008


    >> I don't want to handle writing of a PID file because it is too
    >> Unix/Linux specific way to do this, and I need to keep the code to be
    >> cross-platform.
    >> 
    >> I think the better way to achieve this is to use some process
    >> control, but I'm a neebie and I don't see how to do this in a safe
    >> and clean way.

    Aaron> You could use msvcrt.locking, and just lock the script file.  I
    Aaron> am not sure about this.

If you want a cross-platform solution, you might try the lockfile module
instead:

    http://pypi.python.org/pypi/lockfile

Skip



More information about the Python-list mailing list