Best way to capture output from an exec'ed (or such) script?
exscape at gmail.com
exscape at gmail.com
Thu Aug 2 15:48:06 EDT 2007
More information about the Python-list mailing list
Thu Aug 2 15:48:06 EDT 2007
- Previous message (by thread): Best way to capture output from an exec'ed (or such) script?
- Next message (by thread): Best way to capture output from an exec'ed (or such) script?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hey everyone, I'm writing a tiny web server, mostly to learn - security and such is a non-issue, but learning how to make things secure is of course nice too. To be clear - I will most likely not even use it myself. In any case. I've added some minor scripting support, so that you can write dynamic pages in Python. To do this, I use execfile(), and pass the script a dictionary with some basic variables. The script then sets a "ret" variable that's sent back to the browser. That's some major ugliness right there! If I do a "print" inside the script, then it'll end up on the server console. I want it to end up in the web browser. How would I accomplish this, i.e. redirect the standard output to somewhere else, such as a variable in the calling script? If it's not easy (as in, quite trivial) just say so. I've been thinking about popen(2,3,4) but that's almost as ugly, if not even worse, than the current "solution". Thanks in advance.
- Previous message (by thread): Best way to capture output from an exec'ed (or such) script?
- Next message (by thread): Best way to capture output from an exec'ed (or such) script?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list