modify a long-running python script while it is running?

Benjamin Rutt rutt at bmi.osu.edu
Mon Dec 19 17:11:04 EST 2005


I often execute a long-running python script which is a "driver" for
my application; it may run for several hours on a large input.

Under CPython, is it safe for me to modify the Python script and run
it under some smaller inputs for test purposes, while the long-running
script is still running?  It seems safe to do so, but I want to be
sure.  I know, for example, that #!/bin/sh on my system is not safe in
this regard.

I suppose this question could be reformatted as "does CPython read the
entire script file into memory and then close the file before
executing the script, making it safe for me to modify the script after
I know it has started?"[1]

Thank you,

Footnotes: 
[1] how would I know that it is started?  For example, at least one
print statement I am expecting has been executed.
-- 
Benjamin Rutt



More information about the Python-list mailing list