The way to go is to create a named pipe. If logfile
is the name of your logfile:
import os
import subprocess
LOGFILE = 'somefile.log'
if not os.path.exists(LOGFILE):
os.mkfifo(LOGFILE)
proc = subprocess.Popen([YOUR_PROGRAM])
with open(LOGFILE) as log:
data = log.read() # process your data
proc.wait()