python debug 工具 better-exceptions
安装方法
# install
pip install better_exceptions
# set the BETTER_EXCEPTIONS environment variable to any value
export BETTER_EXCEPTIONS=1 # Linux / OSX
setx BETTER_EXCEPTIONS 1 # Windows
使用方法
import better_exceptions
better_exceptions.MAX_LENGTH = None
GitHub地址
https://github.com/Qix-/better-exceptions
显示错误: 出现��
c = a + b
�� �� ‘b’
�� 1
这是由于windows平台python3.6及以上版本导致的
解决方法:
# file "better_exception/encoding.py" line 10
ENCODING = locale.getpreferredencoding(),
# 替换为
ENCODING = sys.getdefaultencoding()