报错如下:
File "/home/chaoma/3superboard/Store/Data.py", line 253, in getVideoTime
totalTime = subprocess.check_output(strCmd , shell=True)
totalTime = totalTime.strip("\n").strip("\r")
TypeError: Type str doesn't support the buffer API
原因:totalTime是bytes
解决办法:将totalTime从bytes解码转换为unicode字符串
totalTime = subprocess.check_output(strCmd , shell=True)
#这边获取的是bytes,必须转换成unicode字符串,解码
if isinstance(totalTime , bytes):
totalTime = totalTime.decode("utf-8")