[Tutor] Modifying Source Code while Program is Running

Kent Johnson kent37 at tds.net
Thu Nov 24 14:32:41 CET 2005


Ed Singleton wrote:
> Is it feasible to change a program's source code whilst it is running
> without having to restart the program?  Is it feasible to get a
> program to change it's own source code while it is running?
> 
> For example, if you have a web server such as CherryPy that will
> (hopefully) be running for months at a time and you want to be able to
> change classes without having to restart the server.  Or if you want
> to allow users of the site to edit a class through the web and see the
> changes to the site immediately?

This is hard. IIRC CherryPy has a way to automatically restart the server when a module changes, which is not what you ask for but at least it is automatic. A couple of recent threads on comp.lang.python have talked about this:

http://groups.google.com/group/comp.lang.python/browse_frm/thread/8bb4efbe726c4ab5/848860f76210be69
http://groups.google.com/group/comp.lang.python/browse_frm/thread/7b34c30c5833a9b0/4ed71bb7c5a97b57

Kent
-- 
http://www.kentsjohnson.com



More information about the Tutor mailing list