Ok, thanks for all the help guys. It seems that running this type of script from inside of the html just isn't going to work as needed. Seems like I'll just have to ditch the .shtml and point directly to a cgi. This is how the other Python frameworks and sites work, such as reddit and plone etc right?
-- http://mail.python.org/mailman/listinfo/python-list