oFid = gzip.open(filtSortFile, 'wb')
sort = subprocess.Popen(args='sort ', shell=True, stdin=subprocess.PIPE,
    stdout=subprocess.PIPE)
oFid.writelines(sort.stdout)
oFid.close()
подпроцесс python с gzip