Re: Pause a thread/ execfile()

2009-10-27 Thread Aahz
In article 352fe298-75b1-4bc3-aca0-ecd0165f5...@h40g2000prf.googlegroups.com, Babloo pruthviraj...@gmail.com wrote: i have a small python application with GUI (frontend) which has various functions. I have a RUN button which runs python scripts in the background . It basically calls execfile()

Pause a thread/ execfile()

2009-10-26 Thread Babloo
would pause the running python script . So do that i have to either pause the thread in which execfile() runs or pause execfile itself . When the user presses RUN again then the python script should resume running . Any ideas how to pause the thread / pause execfile() . Any other ideas for the same

Re: Pause a thread/ execfile()

2009-10-26 Thread Sean DiZazzo
to pause the thread / pause execfile() . Any other ideas for the same would be helpful . Thanks I think you can do that with a threading.event(). In the gui, create a new threading.event() and pass it in to the worker thread. Set up your code in the worker so that on every iteration of work

Re: Pause a thread/ execfile()

2009-10-26 Thread Saju Pillai
to implement a PAUSE feature which would pause the running python script . So do that i have to either pause the thread in which execfile() runs or pause execfile itself . When the user presses RUN again then the python script should resume running . Any ideas how to pause the thread / pause

Re: Pause a thread/ execfile()

2009-10-26 Thread Babloo
script should resume running . Any ideas how to pause the thread / pause execfile() . Any other ideas for the same would be helpful . Other ideas ? You could use job control signals if you are on unix. Try forking a child process instead of using a thread. Sending SIGSTOP to the forked

Re: Pause a thread/ execfile()

2009-10-26 Thread Babloo
RUN again then the python script should resume running . Any ideas how to pause the thread / pause execfile() . Any other ideas for the same would be helpful . Thanks I think you can do that with a threading.event().  In the gui, create a new threading.event() and pass

Re: Pause a thread/ execfile()

2009-10-26 Thread Sean DiZazzo
execfile() runs or pause execfile itself . When the user presses RUN again then the python script should resume running . Any ideas how to pause the thread / pause execfile() . Any other ideas for the same would be helpful . Thanks I think you can do that with a threading.event

Re: Pause a thread/ execfile()

2009-10-26 Thread Terry Reedy
Babloo wrote: Any ideas how to pause execfile()? As far as the calling instance of the Python interpreter is concerned, calling execfile (or any C function) is an atomic action. You need to rewrite the code in the file executed to have it monitor a semaphore. --