[問題] 解碼Base64字串並轉成byte array

作者: dwadefans (wade)   2016-06-19 13:48:05
我的client端為Android平台撰寫語言為Java
在Java端將byte array ( byte[] ) 編碼成base64字串
送至Python 的 Server端接收到base64字串
但是要將此字串解碼為python的byte array遇到了一些問題
des_encoded = request.args["des_encoded"]
data = base64.b64decode(des_encoded)
錯誤訊息:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/twisted/web/http.py", line
1439, in dataReceived
finishCallback(data[contentLength:])
File "/usr/local/lib/python2.7/dist-packages/twisted/web/http.py", line
1708, in _finishRequestBody
self.allContentReceived()
File "/usr/local/lib/python2.7/dist-packages/twisted/web/http.py", line
1781, in allContentReceived
req.requestReceived(command, path, version)
File "/usr/local/lib/python2.7/dist-packages/twisted/web/http.py", line
768, in requestReceived
self.process()
作者: alibuda174 (阿哩不達)   2016-06-19 14:21:00
錯誤訊息不是說了,你應丟進去string或buffer但你卻丟進去list
作者: dwadefans (wade)   2016-06-20 13:34:00
我的type真的是list... 好奇怪 原來如此 我在檢查謝謝

Links booklink

Contact Us: admin [ a t ] ucptt.com