Executing a python script while it is running

Dave Angel davea at ieee.org
Tue Jun 16 18:42:06 EDT 2009

Zach Hobesh wrote:
> Hi everybody,
> Here's my situation:
> I have a batch file that calls a python script.
> This batch file is triggered by an outside application when the
> application completes a task.  The problem is that while the batch
> file (and pythons script) is running, the application will complete
> the next task, and try to call the batch file again (while it is
> already running)
> Hopefully that's not too confusing.
> I'm not sure what direction to go with this, any help or nudges in the
> RIGHT direction would be greatly appreciated.
A lot more information would be useful.  What version of Python, and 
what operating system environment?  Exactly what would you like to 
happen when the batch file is invoked a second time?

Possibilities that occur to me:
   1) ignore the second run
   2) let them both run as separate processes
   3) abort the first run, as the second one will replace it
   4) queue something to be processed when the first run finishes

What provisions does this existing application have for long-running 
batch files?  Seems the synchronization ought to happen there.  Do you 
have any constraints on how long your script might take, worst case?  
What if the application finishes its tasks at a faster average rate than 
your script can process them?

More information about the Python-list mailing list