如何获取管道的传输数据量大小?

使用Python调用外部mysqldump对mysql数据库进行备份,并形成压缩文件,我现在想知道从数据库中抽取的备份数据量具体大小,代码如下:
count = 0
with gzip.open(bakfilname, "wb") as f:
p1 = subprocess.Popen(mysqldump + " -h %s --port %s -u %s -p%s %s --databases %s " % (ip,port, str_user, str_passwd, str_bk_options, str_schemas), stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=True)
f.writelines(p1.stdout)
while True:
byte = p1.stdout.read(1)
if not byte:
break
count = count + 1

上述代码得出的count值为0,请教问题出在什么地方?