see the simple example in local/passpersisttest
You need to specify unbuffered output for python to work. The first line should look like:
#!/usr/bin/python -u