0
소켓 연결을 통해 목록을 보내려고하지만 Can't convert 'bytes' object to str
오류가 발생합니다. python3 - 'bytes'객체를 암시 적으로 str으로 변환 할 수 없습니다.
while True:
try:
data = stream.read(CHUNK)
except IOError:
pass
else:
decoded = numpy.fromstring(data, dtype=numpy.float32)
i = json.dumps(decoded.tolist())
jsonDecoded = json.loads(i)
jsonS = "%s" % jsonDecoded
ws.send(jsonS)
는 또한 나에게 같은 오류를 제공하는
"".join(str(x) for x in jsonDecoded)
뿐만 아니라
jsonS = "{}".format(jsonDecoded, 'utf-8')
을 시도했다.
str(jsonDecoded, 'utf-8')
이 작동하지 않습니다.
아이디어가 있으십니까?
여기에 전체 스택 트레이스
Traceback (most recent call last):
File "C:\Users\Bart\Dropbox\Redux\streaming\streaming\streamingdata.py", line 39, in <module>
ws.send(jsonS)
File "C:\Python33\lib\site-packages\websocket_client_py3-0.14.1-py3.3.egg\websocket\__init__.py", line 655, in send
return self.send_frame(frame)
File "C:\Python33\lib\site-packages\websocket_client_py3-0.14.1-py3.3.egg\websocket\__init__.py", line 674, in send_frame
data = frame.format()
File "C:\Python33\lib\site-packages\websocket_client_py3-0.14.1-py3.3.egg\websocket\__init__.py", line 340, in format
frame_header += struct.pack("!H", length)
TypeError: Can't convert 'bytes' object to str implicitly
'websocket \ __ init __. py'에 330-350 행은 무엇입니까? 구식 패키지가있을 수 있습니다. Github 레포에서 최신 버전을 가져 오는 경우 어떻게됩니까? – Veedrac
고마워요! 그것은 그것을 고쳤다! – boortmans