Thanks guys, you've helped me very much :) Cheers & happy new year!
--
http://mail.python.org/mailman/listinfo/python-list
Thomas Troeger wrote:
> I've written a program that parses a string or file for embedded python
> commands, executes them and fills in the returned value. The input might
> look like this:
>
> process id: $$return os.getpid()$$
> current date: $$return time.ctime()$$
> superuser: $$
> if os.get
On Jan 10, 1:10 pm, Thomas Troeger <[EMAIL PROTECTED]>
wrote:
> Dear all,
>
> I've written a program that parses a string or file for embedded python
> commands, executes them and fills in the returned value. The input might
> look like this:
>
> process id: $$return os.getpid()$$
> current date: $
On Thu, 10 Jan 2008 14:10:05 +0100, Thomas Troeger wrote:
> I've written a program that parses a string or file for embedded python
> commands, executes them and fills in the returned value. The input might
> look like this:
>
> process id: $$return os.getpid()$$
> current date: $$return time.c
Thomas Troeger <[EMAIL PROTECTED]> wrote:
> I've written a program that parses a string or file for embedded
> python commands, executes them and fills in the returned value.
> ...
> I've tried several solutions using eval, execfile or compile, but
> none of those would solve my problem. Does anyon
Ok I've written a small example program to clarify matters:
[SNIP]
#!/usr/bin/python
import os, sys, time
def template(src, dst, sep):
"""
Copy file from src to dst, executing embedded python code.
"""
try:
#
On Jan 10, 2:10 pm, Thomas Troeger <[EMAIL PROTECTED]>
wrote:
> Dear all,
>
> I've written a program that parses a string or file for embedded python
> commands, executes them and fills in the returned value. The input might
> look like this:
>
> process id: $$return os.getpid()$$
> current date: $
Dear all,
I've written a program that parses a string or file for embedded python
commands, executes them and fills in the returned value. The input might
look like this:
process id: $$return os.getpid()$$
current date: $$return time.ctime()$$
superuser: $$
if os.geteuid():
return "Yes"