PyBaiduYuyin icon indicating copy to clipboard operation
PyBaiduYuyin copied to clipboard

TypeError(repr(o) + " is not JSON serializable")

Open alatriste-lee opened this issue 7 years ago • 1 comments

self.request = Request(url, data = json.dumps(data), headers = {"Content-Type": "application/json"})

json.dumps(data)

alatriste-lee avatar Sep 22 '16 06:09 alatriste-lee

也碰到这个问题。 不过我改了代码。百度的post data规格改了。 data = { "format": "pcm", # "lan": self.language, "token": self.token, "len": len(audio_data.data), # "rate": audio_data.rate, "rate": 8000, "channel" : 1, "speech": base64.b64encode(audio_data.data), "cuid": '93489083242', }

不过出现另外一个问题 with sr.WavFile(WAV_FILE) as source: audio = r.record(source) # read the entire WAV file 读不出数据!!! audio为空!!

makelove avatar Nov 11 '16 08:11 makelove