Strato 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.

There's nothing built in to Python to do this, so you'll
probably have to roll your own cross-platformness. Of
course, there's nothing to stop you from writing pid
files under Windows even if it's not the usual way.
Or you could just put some conditional code, and use
the kernel mutex under Windows, which is the generally
recommended technique. Have a look at this thread,
for example (among several others):

http://mail.python.org/pipermail/python-list/2005-June/327063.html


TJG
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to