arcade 读取地图信息时:错误: ‘gbk‘ codec can‘t decode byte 0x91 in position 314: illegal multibyte sequence
arcade 读取地图信息时:错误: 'gbk' codec can't decode byte 0x91 in position 314: illegal multibyte sequence
E:\pgame\venv\Scripts\python.exe E:/pgame/arcadegame/game10-地图双层.py
path: E:\pgame\venv\Lib\site-packages\arcade\resources
Traceback (most recent call last):
File "E:/pgame/arcadegame/game10-地图双层.py", line 208, in <module>
main()
File "E:/pgame/arcadegame/game10-地图双层.py", line 203, in main
window.setup()
File "E:/pgame/arcadegame/game10-地图双层.py", line 83, in setup
self.tile_map = arcade.load_tilemap(map_name, TILE_Scaling, layer_options)
File "E:\pgame\venv\lib\site-packages\arcade\tilemap\tilemap.py", line 963, in load_tilemap
offset=offset,
File "E:\pgame\venv\lib\site-packages\arcade\tilemap\tilemap.py", line 187, in __init__
self.tiled_map = pytiled_parser.parse_map(map_file)
File "E:\pgame\venv\lib\site-packages\pytiled_parser\parser.py", line 21, in parse_map
parser = check_format(file)
File "E:\pgame\venv\lib\site-packages\pytiled_parser\util.py", line 42, in check_format
line = file.readline().rstrip().strip()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x91 in position 314: illegal multibyte sequence
错误:
def check_format(file_path: Path) -> str:with open(file_path) as file:# print(file.readline())line = file.readline().rstrip().strip()if line[0] == "<":return "tmx"else:return "json"
原因:地图文件中有汉字
改为如下后:
def check_format(file_path: Path) -> str:with open(file_path,encoding='utf-8') as file:# print(file.readline())line = file.readline().rstrip().strip()if line[0] == "<":return "tmx"else:return "json"
此处过去了,但在后面又出现了错误
E:\pgame\venv\Scripts\python.exe E:/pgame/arcadegame/game10-地图双层.py
path: E:\pgame\venv\Lib\site-packages\arcade\resources
Traceback (most recent call last):
File "E:/pgame/arcadegame/game10-地图双层.py", line 208, in <module>
main()
File "E:/pgame/arcadegame/game10-地图双层.py", line 203, in main
window.setup()
File "E:/pgame/arcadegame/game10-地图双层.py", line 83, in setup
self.tile_map = arcade.load_tilemap(map_name, TILE_Scaling, layer_options)
File "E:\pgame\venv\lib\site-packages\arcade\tilemap\tilemap.py", line 963, in load_tilemap
offset=offset,
File "E:\pgame\venv\lib\site-packages\arcade\tilemap\tilemap.py", line 187, in __init__
self.tiled_map = pytiled_parser.parse_map(map_file)
File "E:\pgame\venv\lib\site-packages\pytiled_parser\parser.py", line 25, in parse_map
return tmx_map_parse(file) # type: ignore
File "E:\pgame\venv\lib\site-packages\pytiled_parser\parsers\tmx\tiled_map.py", line 25, in parse
raw_map = etree.parse(map_file).getroot()
File "D:\Python37\lib\xml\etree\ElementTree.py", line 1197, in parse
tree.parse(source, parser)
File "D:\Python37\lib\xml\etree\ElementTree.py", line 598, in parse
self._root = parser._parse_whole(source)
UnicodeDecodeError: 'gbk' codec can't decode byte 0x91 in position 314: illegal multibyte sequence
最终还是放弃在地图中使用中文吧
arcade 读取地图信息时:错误: ‘gbk‘ codec can‘t decode byte 0x91 in position 314: illegal multibyte sequence相关推荐
- Python 基于csv 读取文本文件提示:‘gbk‘ codec can‘t decode byte 0xbf in position 2: illegal multibyte sequence
报错 Python 基于csv 读取文本文件提示:'gbk' codec can't decode byte 0xbf in position 2: illegal multibyte sequenc ...
- UnicodeDecodeError: 'gbk' codec can't decode byte 0x91 in position 8: illegal multibyte sequence
解决方法:http://www.cnblogs.com/mengyu/p/6638975.html 用方法1可以,方法2是乱码.
- python中txt文件读取错误原因以及解决办法‘gbk‘ codec can‘t decode byte 0x80 in position 2: illegal multibyte sequence
python的读写文件操作时,有时候会出现一些小问题,详细如下,(原因在前面,解决办法在文末). 读取txt文件时出现错误反馈如下: Traceback (most recent call last) ...
- ‘gbk‘ codec can‘t decode byte 0xad in position 2: illegal multibyte sequence 错误的解决方法
UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 2: illegal multibyte sequence 翻译: ...
- 文章读取 'gbk' codec can't decode byte 0x9d in position 1793: illegal multibyte sequence
python读取文件的时候经常会遇到编码于解码的问题,其中常见的一种解码错误是'gbk' codec can't decode byte 0x9d in position 1793: illegal ...
- ‘UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x80 in position 2: illegal multibyte sequence’
import matplotlib.pyplot as pltplt.rcParams['font.sans-serif'] = ['KaiTi'] with open(r'E:\pythoncoda ...
- UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xf9 in position 56: illegal multibyte sequence
项目场景: pycharm中读取文件报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0xf9 in position 56: illegal ...
- UnicodeDecodeError: 'gbk' codec can't decode byte 0xab in position 43: illegal multibyte sequence
python读取txt文件时报错: UnicodeDecodeError: 'gbk' codec can't decode byte 0xab in position 43: illegal mul ...
- UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 199: illegal multibyte sequence
在做<机器学习实战>里的朴素贝叶斯算法时提示错误 UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 19 ...
最新文章
- 设置VMware随系统开机自动启动并引导虚拟机操作系统
- 计算机网络职称可以免考么,谁知道四川职称计算机考试的免考条件啊,我要去评职称,但不想去考职? 爱问知识人...
- KERNELRELEASE
- win系统如何连接共享服务器,window7 pro 访问局域网内共享服务器
- Python 检测字符串开始值String.StartsWith 方法
- python如何安装pdfminer_|请教在python3中安装pdfminer.six的方法
- 阿里云安装宝塔打不开 已经开放安全组_centOS7 apache安装PHPMYADMIN
- 12-Python3 元组
- python数据驱动读取用例_Python3-unittest测试框架之DDT数据驱动
- Sql Server2005分离数据库
- CentOS | 资产管理软件GLPI+OCS安装与配置
- lsd 特征点匹配代码_直线匹配-LSD算法
- calc桌面计算机,Calc1(桌面计算器)
- vue-echarts绘制地图轮廓
- React类式组件基础内容补充
- Revit建模:使用技巧【族类应用】希望能帮大家提高效率
- 关于精准打击自签名伪造SSL/TLS “受信任域名证书”的方案
- linux redis自启动
- 高等数学学习笔记——第四十九讲——一阶常微分方程的求解
- BZOJ 2277 strongbox (gcd)
热门文章
- .NET Core 3.1部署到Docker后使用Nginx代理
- UbuntuFTP文件传输安装
- 采用UltraISO软碟通制作UbuntuU盘启动盘教程
- 靶场练习Exploiting cross-site scripting to steal cookies
- 浪潮信息人工智能巨量模型“源1.0”,切实促进AI行业高质量发展
- Mysql current_time,current_date()与now()区别
- 世界大学经济与商科排名:香港科大中国第一
- ※ 数字图像——绿幕抠像
- 浅谈列控系统的阶梯式分级速度控制中专有名词的表述问题
- java计算机毕业设计驾校管理系统MyBatis+系统+LW文档+源码+调试部署