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 ...
随机推荐
- Go websocket EOF bug
背景 使用的 golang.org/x/net/websocket 包,前端一发来消息就报错 if err = websocket.Message.Receive(ws, &msg); err ...
- JMeter学习笔记--工具简单介绍
一.JMeter 介绍 Apache JMeter是纯JAVA桌面应用程序,被设计为用于测试客户端/服务端结构的软件(例如web应用程序).它可以用来测试静态和动态资源的性能,例如:静态文件,Java ...
- DOS常用基本命令
通配符* 和 ? *表示一个字符串 ?只代表一个字符 注意通配符只能通配文件名或扩展名,不能全都表示.例如我们要查找以字母y开头的所有文件,可以输入以下命令: dir y*.* 例如我要查找第二个字母 ...
- 【数据结构&算法】11-树基础&二叉树遍历
目录 前言 树的定义 树的存储结构 双亲表示法 孩子表示法 孩子兄弟表示法 二叉树 定义 特点 形态 特殊二叉树 斜树 满二叉树 完全二叉树 二叉树的性质 二叉树的存储结构 二叉树的顺序存储结构 二叉 ...
- git clone报错处理
git clone过大的仓库时会报以下错误 remote: aborting due to possible repository corruption on the remote side. fat ...
- Python科普系列——类与方法(上篇)
欢迎来到新的系列,up又开新坑了~~ 实际上,Python作为一门易用性见长的语言,看上去简单,却仍然有很多值得一说的内容,因此这个系列会把Python中比较有意思的地方也给科普一遍.而另一方面,关于 ...
- 偷天换日,用JavaAgent欺骗你的JVM
原创:微信公众号 码农参上(ID:CODER_SANJYOU),欢迎分享,转载请保留出处. 熟悉Spring的小伙伴们应该都对aop比较了解,面向切面编程允许我们在目标方法的前后织入想要执行的逻辑,而 ...
- [cf1479E]School Clubs
对于当前班级状态$S$,定义一个函数$\varphi(S)$,要求其满足: 令结束状态为$S_{end}$,对于任意$S\ne S_{end}$,若其下一个状态为$S'$,则$E(\varphi(S) ...
- [noi109]排队
题目要求其实相当于要让大于和小于m的数的个数都不超过n/2,因此当要对一个数处理时,要么把它改成m,要么不作修改,根据这个贪心就可以完成了. 1 #include<bits/stdc++.h&g ...
- 回顾Servlet开发
1.建立的文件 2.servlet package com.shao.servlet; import javax.servlet.ServletException; import javax.serv ...