[Python] Blogs

Bob Miller kbob at jogger-egg.com
Mon Jan 21 19:22:03 PST 2008


I've been thinking about starting a coding blog.  Anyone here have any
experience with the major blog providers?  I anticipate posting
a lot of code excerpts, so easy and good-looking code blocks, both
in the article and in comments, are a primary concern.

Tonight's clever hack is the restarter.  It watches for any source
code to change, and when it does, it restarts the application.
While I do love you guys, I'd like to share it with a wider audience.
Or, rather, I'd like to try to build a bigger audience.

(Outline.  Iterate through sys.modules.  Get each module's __file__.
Munge .pyc -> .py.  Use os.stat() to compare that file's mod time to
the program's start time.  If any are newer, use os.execv()
to restart.  Don't forget to prepend sys.executable to sys.argv.
Finally, throw the whole mess into a daemon thread and run it in
a loop with a short sleep between runs.)

-- 
Bob Miller                              K<bob>
                                        kbob at jogger-egg.com


More information about the Python mailing list