Re: Search within running python scripts

2006-07-24 Thread Simon Forman
Cameron Laird wrote: ... > Particularly when I hear "os-independent", I think first of > binding to a socket. While http://wiki.tcl.tk/1558 > > is written for a Tcl-based crowd, the commentary there ap- > plies quite well to Python. I was going to suggest something like this, as I have noticed th

Re: Search within running python scripts

2006-07-24 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Simon Forman <[EMAIL PROTECTED]> wrote: >gmax2006 wrote: . . . >> > Yes, there are several ways. What OS are you using? >> > >> > ~Simon >> >> I have to use an os-independent approach. >> >> At

Re: Search within running python scripts

2006-07-24 Thread Simon Forman
gmax2006 wrote: > Simon Forman wrote: > > gmax2006 wrote: > > > Hi, > > > > > > Is it possible that a python script finds out whether another instance > > > of it is currently running or not? > > > > > > Thank you, > > > Max > > > > Yes, there are several ways. What OS are you using? > > > > ~Simo

Re: Search within running python scripts

2006-07-24 Thread gmax2006
Simon Forman wrote: > gmax2006 wrote: > > Hi, > > > > Is it possible that a python script finds out whether another instance > > of it is currently running or not? > > > > Thank you, > > Max > > Yes, there are several ways. What OS are you using? > > ~Simon I have to use an os-independent approa

Re: Search within running python scripts

2006-07-24 Thread faulkner
IPC via files, sockets, and shared memory are all readily available in python. the simplest way is to have the script write its pid to a certain file. pidfn = '/tmp/hellowerld_ipc_pid' if os.path.isfile(pidfn): f = file(pidfn) pid = f.read() f.close() if pid in os.popen('ps -A -o p

Re: Search within running python scripts

2006-07-24 Thread Simon Forman
gmax2006 wrote: > Hi, > > Is it possible that a python script finds out whether another instance > of it is currently running or not? > > Thank you, > Max Yes, there are several ways. What OS are you using? ~Simon -- http://mail.python.org/mailman/listinfo/python-list

Search within running python scripts

2006-07-24 Thread gmax2006
Hi, Is it possible that a python script finds out whether another instance of it is currently running or not? Thank you, Max -- http://mail.python.org/mailman/listinfo/python-list