针对django2.2报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 9737: ill....
1、报错:
File "D:\Python\Python37-32\lib\site-packages\django\views\debug.py", line 332, in get_traceback_html
t = DEBUG_ENGINE.from_string(fh.read())
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 9737: illegal multibyte sequence
2、解决:
打开django/views下的debug.py文件,转到line331行:
with Path(CURRENT_DIR, 'templates', 'technical_500.html').open() as fh
将其改成:
with Path(CURRENT_DIR, 'templates', 'technical_500.html').open(encoding="utf-8") as fh
就成功了。
针对django2.2报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 9737: ill....的更多相关文章
- 【python】python读取文件报错UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 2: illegal multibyte sequence
python读取文件报错UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 2: illegal multibyte ...
- python读取txt文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x8e in position 8: illegal multibyte sequence
python读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x8e in position 8: illegal multibyte ...
- 安装mysql-python报错:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 65: ordinal not in range(128)
安装mysql-python报错: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 65: ordinal n ...
- python 读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multib
python 读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multib ...
- django startproject xxx:报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 13: ordinal not in range(128)
django startproject xxx:报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 13: o ...
- python 网络爬虫报错“UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position”解决方案
Python3.x爬虫, 发现报错“UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1:invalid sta ...
- python 读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multibyte sequence
python读取文件时提示"UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal m ...
- saltstack--关于报错“UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 6: ordinal not in range(128)”
[root@linux-node1 桌面]# salt-key [ERROR ] 'ascii' codec can't decode byte 0xe6 in position 6: ordinal ...
- python3运行调用htmltestrunner时,报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 0
之前解决过一次,又忘了,这次写下来了..百度没有的,跟我环境有关! 环境:自动化运行环境python3.6.5 上期说到了,写了一个bat来运行runallcase.py. 但是双击运行却报错:Uni ...
随机推荐
- synchronized的锁问题
有一个类A,提供了三个方法.分别是静态同步方法,非静态同步方法,含有静态代码块的方法 1 class A{ 2 public static synchronized void print1(){ 3 ...
- Python参数传递(传值&传引用)
# 测试参数是传值还是传引用def test(arg): print("test before") print(id(arg)) arg[1]=30 # 测试可变对象 # arg[ ...
- 多浏览器播放wav格式的音频文件
html5的audio标签只在火狐下支持wav格式的音频播放,无法兼容IE和google , 使用audioplayer.js 基本上能支持大部分浏览器播放wav音频文件,经测试IE.火狐.googl ...
- @addTagHelper的使用
@addTagHelper用来在cshtml页面加入自定义的Tag @addTagHelper “[the full type name of taghelper,] the assembly nam ...
- 【PAT】A1001A+B Format
最新想法: 最多是七位数,而且只有一组输入,完全不用考虑算法复杂度. 直接判断是否为负,并输出符号 巧妙的地方:while循环的下一次再添加逗号.(防止出现,999,991的情况) 婼姐的方法真的很巧 ...
- P进制转Q进制
// 对一个P进制的数,如果要转换成Q进制的数 // 1)将P进制数x转换成十进制数y int y=0,product=1;//product在循环中会不断成P,得到1.P^2..... while( ...
- January 02nd, 2018 Week 01st Tuesday
I dream my painting, and then I paint my dream. 我梦见我的画,然后我画我的梦. It was a long time after I had a goo ...
- python scrapy爬取知乎问题和收藏夹下所有答案的内容和图片
上文介绍了爬取知乎问题信息的整个过程,这里介绍下爬取问题下所有答案的内容和图片,大致过程相同,部分核心代码不同. 爬取一个问题的所有内容流程大致如下: 一个问题url 请求url,获取问题下的答案个数 ...
- 在Eclipse中使用Maven jetty的debug模式
1.右键项目debug as添加mvn命令: jetty:run 2.进入eclipse的菜单Run->Debug configurations,会看到maven build下对应的项目的mvn ...
- Address already in use: JVM_Bind问题的解决
tomcat一般出现Address already in use: JVM_Bind的问题,可能是端口冲突,也就是端口被占用了. 这个可能是其他应用程序使用了同一个端口(默认是8080),也可能是你启 ...