binlog2sql 解析日志失败 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xba in position 0: invalid start byte
执行报错
Traceback (most recent call last):
File "/export/servers/pbmonitor/exps/static/file/mysql_tools/binlog2sql/binlog2sql.py", line 150, in <module>
binlog2sql.process_binlog()
File "/export/servers/pbmonitor/exps/static/file/mysql_tools/binlog2sql/binlog2sql.py", line 121, in process_binlog
self.print_rollback_sql(filename=tmp_file)
File "/export/servers/pbmonitor/exps/static/file/mysql_tools/binlog2sql/binlog2sql.py", line 129, in print_rollback_sql
for line in reversed_lines(f_tmp):
File "/export/servers/pbmonitor/exps/static/file/mysql_tools/binlog2sql/binlog2sql_util.py", line 249, in reversed_lines
block = block.decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xba in position 0: invalid start byte
第249行,修改block.decode为ignore模式
247 for block in reversed_blocks(fin):
248 if PY3PLUS:
249 block = block.decode("utf-8","ignore")
250 for c in reversed(block):
251 if c == '\n' and part:
252 yield part[::-1]
253 part = ''
254 part += c
255 if part:
256 yield part[::-1]
参考
UnicodeDecodeError: 'utf-8' codec can't decode byte..问题
binlog2sql 解析日志失败 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xba in position 0: invalid start byte的更多相关文章
- TensorFlow学习笔记(UTF-8 问题解决 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte)
我使用VS2013 Python3.5 TensorFlow 1.3 的开发环境 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff ...
- tensorflow UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
tensorflow读取图像出现错误:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid s ...
- Python:出现UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc9 in position 0: invalid continuation byte问题
我在导入一个csv文件的时候出现了一个问题 报错的内容是这样的: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc9 in positio ...
- Pandas读取文件报错UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte
pandas读取文件时报UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start by ...
- TensorFlow学习('utf-8' codec can't decode byte 0xff in position 0: invalid start byte)
使用语句: image_raw_data = tf.gfile.GFile("./picture.jpg", "r").read() 读取图像时报错如下: Un ...
- 读文件时出现这个错误 'utf-8' codec can't decode byte 0xba in position 21: invalid start byte
''' file2 文件内容: 很任性wheniwasyoung ''' 源代码: f = open("file2",'r',encoding="utf-8") ...
- 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
'utf-8' codec can't decode byte 0xff in position 0: invalid start byte 觉得有用的话,欢迎一起讨论相互学习~Follow Me 今 ...
- 第一篇:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 0: invalid continuation byte
需求:python如何实现普通用户登录服务器后切换到root用户再执行命令 解决参考: 代码: def verification_ssh(host,username,password,port,roo ...
- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 0: invalid continuation byte
需求:python如何实现普通用户登录服务器后切换到root用户再执行命令 解决参考: 代码: def verification_ssh(host,username,password,port,roo ...
随机推荐
- linux初中级命令语言
Linux:开源免费.大部分软件都可以自由获取,同样功能的软件选择较少.主要是字符模式,命令行界面且发行版本较多,难以集中攻击. Xshell与xftp是什么? xshell是一个客户端软件,我们本地 ...
- 基于 Istio 的全链路灰度方案探索和实践
作者|曾宇星(宇曾) 审核&校对:曾宇星(宇曾) 编辑&排版:雯燕 背景 微服务软件架构下,业务新功能上线前搭建完整的一套测试系统进行验证是相当费人费时的事,随着所拆分出微服务数量的不 ...
- [源码解析] PyTorch 如何使用GPU
[源码解析] PyTorch 如何使用GPU 目录 [源码解析] PyTorch 如何使用GPU 0x00 摘要 0x01 问题 0x02 移动模型到GPU 2.1 cuda 操作 2.2 Modul ...
- Linux&C网络编程————“聊天室”
从上周到现在一直在完成最后的项目,自己的聊天室,所以博客就没怎么跟了,今天晚上自己的聊天室基本实现,让学长检查了,也有好些bug,自己还算满意,主要实现的功能有: 登录注册 附近的人(服务器端全部在线 ...
- JMeter学习笔记--录制脚本(一)
---------------------------------------------------------------------------------------------------- ...
- SQL注入之猫舍之sqlmap的使用
先说一下最常用的基础指令 -u 指定注入点(一般为url栏的网址) --dbs 跑库名 --tables 跑表名 --columns 跑字段名 --dump 枚举数据(高危指令,容易进去) -D 库名 ...
- 学习JS的第三天
一.逻辑分支(续) 1.三目运算符:条件运算符 a>b?c:d;表达式1?表达式2:表达式3; 根据表达式1执行的结果,来决定执行表达式2还是表达式3 表达式1结果是true执行表达式2,最终返 ...
- CentOS8安装VNC-Server,并使用VNC Viewer连接
1.查看系统信息 # 查看red-hat版本信息 cat /etc/redhat-release CentOS Linux release 8.0.1905 (Core) 2.安装VNC Server ...
- java获取CPU核心数
package ThreadTest; public class ThreadTest05 { public static void main(String[] args) { //获取CPU核心 S ...
- javascript-初级-day05js函数传参
JS基础-01 函数传参.参数类型-1 <!DOCTYPE HTML> <html> <head> <meta http-equiv="Conten ...