Python 2.4.4, Solaris 10 I realize that this is a bit old, but I got severely sidetracked! ~(:>)
On Mon, Apr 20, 2015 at 2:10 AM, Alan Gauld <alan.ga...@btinternet.com> wrote: > I would suggest forgetting about windows and think about > the processes that create them. Use the OS tools (via > the os module) to see if the first process is still running. > If so kill the process - which will in turn kill the window. Is this a reasonable way to determine if a given pid is still active? I found this at: http://stackoverflow.com/questions/568271/how-to-check-if-there-exists-a-process-with-a-given-pid import os def check_pid(pid): """ Check For the existence of a unix pid. """ try: os.kill(pid, 0) except OSError: return False else: return True I realize that this will also return True if I don't have permissions to kill, or some such. > You can find the process based on its name or based on > its PID which you could store in a file somewhere > (like in /tmp?) I can implement this, but thinking about this anew has led to a concern. Hypothetically, if I check for the existence of a running process based on this stored pid, what is the likelihood that the pid will be reassigned to something other than one of my program's windows left open? -- boB _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor