TF Python

TF Python is a patch (which you apparently have installed) for TinyFugue 5.08b which allows TinyFugue to use Python for scripting.

TinyFugue Commands (see each for details):
/python command
python( command )
/python_load module
/python_call module.function argument
/python_kill

Calling back into TinyFugue: TF Python provides Python scripts with a 'tf' module that has several methods - without these it's all fairly useless. Please see /help tf module for info on this.

Speed: The python interpreter is (dynamically) embedded in TinyFugue to reduce overhead and allow tighter coupling. When using /python_load and /python_call all the code is byte compiled on load, so it's quite snappy.

Environment: The environment is persistent, so after '/python import glob' subsequent commands will be able to reference module glob. More importantly it means that after '/python_load mymodule' mymodule will have persistent variables between /python_call invocations.

Arbitrary data from TF: Your program can retrieve any information it needs from TinyFugue by using tf.eval. Please see /help tf module for info on this.

stdout and stderr: by default, stdout is discarded (so you don't see the output of every /python command) and stderr is sent to tferr. You can make stdout active again with:
/python sys.stdout.output = tf.out
and shut it up again with:
/python sys.stdout.output = None
You can do the same with sys.stderr.output, but use tf.err instead.

See the included tf-lib/urlwatch.py and tf-lib/config.py for fairly complex examples.


Back to index
Back to tf home page
Copyright © 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004, 2005, 2006-2007 Ken Keys