Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


Top White Papers

More on LinuxToday


IBM developerWorks: Charming Python: Dynamically reloading modules in long-running processes

Nov 24, 2000, 13:22 (0 Talkback[s])
(Other stories by David Mertz)

[ Thanks to Shailendra for this link. ]

"A great advantage of Python over most other programming languages is its extreme runtime dynamism capabilities. Thanks to the handy reload() function, we can write programs that run persistently, but that load components that have been modified during the run of the process (pretty useful for services where continuous uptime is critical). This article illustrates runtime program modification by means of some enhancements to the Txt2Html front-end discussed in David's earlier article . Specifically, our sample program will do a background check for new versions of the Txt2Html conversion library on the Internet, and download and reload any new version as needed without manual user intervention."

"Let's paint a scenario for this article: Suppose you want to run a process on your local machine, but part of your program logic lives somewhere else. Specifically, let us assume that this program logic is updated from time to time, and when you run your process, you would like to use the most current program logic. There are a number of approaches to addressing the requirement just described; this article walks you through several of them."

"As this Charming Python column has progressed, I have discussed ongoing enhancements to my public-domain utility Txt2Html. This utility converts "smart ASCII" text files to HTML. Previous articles discussed the Web-proxy version of the utility and a curses interface for the utility. Also I occasionally notice that some ASCII markup could be converted in a more useful way, or I fix a bug in handling a particular markup construct."

Complete Story

Related Stories: