Question about exec()

Adonis adonisv at REMTHISearthlink.net
Sun May 30 16:46:36 EDT 2004


I wrote a small webserver and a small html parser to parse some elements, in
which contain python code, now before I go any further your thinking "not
another web application server" and before being routed to Twisted, Zope,
Webware, Mod_Python, etc., this is a learning project, it is for my amusment
and better understanding. Nevertheless, inside the html document I have
python enclosed in <? ?> tags, and it executes fine, but if I have a few of
those tags I would like that prior executions stay in memory of the same
document, instead of having to load X module everytime I wish to execute the
code in the same document.

To ellaborate further:
(same document)

<some html code here>
<?
    import sys
    print sys.version
?>
<some more html code>
<?
    print sys.platform
?>

Any help is greatly appreciated.

Adonis





More information about the Python-list mailing list