Question about exec()

From: Adonis (adonisv_at_REMTHISearthlink.net)
Date: 05/30/04


Date: Sun, 30 May 2004 20:46:36 GMT

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



Relevant Pages

  • Re: Python/HTML integration: phileas v0.3 released
    ... to templatng language. ... ways of generating XML/HTML from Python code in a natural looking way? ... There is, however, one big difference between phileas and all other ... theory this is less neat and indeed it means one can write 'bad' HTML ...
    (comp.lang.python)
  • python html rendering
    ... with correct indentation, possibly syntax hiliting, dealing correctly with multi-line comment, and... ... generating valid html code if the python code itself deals with html (hence manipulates tag litterals. ...
    (comp.lang.python)
  • Re: Zope vs Php
    ... Steve wrote: ... > I am going to go the mod_python route. ... > is that the number of lines of html/output vs python code are usually ... share your opinion about html in code, but I also dislike code in html... ...
    (comp.lang.python)
  • Re: python html rendering
    ... in html: with correct indentation, possibly syntax hiliting, dealing ... the python code itself deals with html (hence manipulates tag litterals. ...
    (comp.lang.python)
  • Re: word webpages
    ... The ther are som tags with no closing tags DreamWeaver would remove what ever was causing these problems. ... Just create a simple document and save as HTML Make sure it has some type of formatting. ... XML all versions ...
    (microsoft.public.mac.office.word)