在Spyder中我可以毫无错误地运行脚本:
filename = '$tmp$.tmp'
# create binary file with all bytes
with open(filename, 'wb') as f:
f.write(bytearray(list(range(255))))
# read bytes back
with open(filename, 'rb') as f:
buffer=f.read()
print(buffer)
但是在调试期间,执行行" buffer = f.read()"
后抛出异常...
File "C:\Miniconda3\lib\site-packages\spyder\widgets\variableexplorer\utils.py", line 458, in value_to_display
display = display[:70].rstrip() + ' ...'
TypeError: can't concat str to bytes
调试期间没有错误:
buffer=bytearray(list(range(255)))
print(buffer)
我使用conda 4.5.0,spyder 3.2.8 py36_0。对于新的调试会话,缓冲区变量必须在控制台中删除或重新分配给number,text。 存在一种解决方法?