zcat = subprocess.Popen(['zcat', path], stdout=subprocess.PIPE)
for chunk in iter(functools.partial(zcat.stdout.read, 8192), ''):
    do_stuff(chunk)
zcat.wait()
Python equivalent of piping zcat result to filehandle in Perl