testing if another instance of a script is already running

Aaron "Castironpi" Brady castironpi at gmail.com
Sat Sep 13 18:14:11 EDT 2008


On Sep 12, 7:08 am, Strato <pyt... at p0w.org> wrote:
> Hi folks,
>
> I want to write some kind of test to check at startup if another
> instance of my script is already running.
>
> 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.
>
> Any idea ?
>
> Best regards,
> Strato

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



More information about the Python-list mailing list