python35 ./binlog2sql.py -h... -P... -u... -p... -B --start-file="mysql-bin.091940" --start-position=43669051 --stop-position=65769997 > /export/logs/redo.sql

执行报错

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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. 读文件时出现这个错误 'utf-8' codec can't decode byte 0xba in position 21: invalid start byte

    ''' file2 文件内容: 很任性wheniwasyoung ''' 源代码: f = open("file2",'r',encoding="utf-8") ...

  7. '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 今 ...

  8. 第一篇: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 ...

  9. 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 ...

随机推荐

  1. 计算机网络-3-2-点对点协议PPP

    点对点协议PPP 在通信链路较差的年代,在数据链路层使用可靠传输协议曾经是一种好方法,比较简单的点对点PPP协议则是目前使用最广泛的数据链路层协议. PPP协议的特点 互联网用户通过都要连接到某个IS ...

  2. QuantumTunnel:Netty实现

    接上一篇文章内网穿透服务设计挖的坑,本篇来聊一下内网穿透的实现. 为了方便理解,我们先统一定义使用到的名词: UserClient:用户客户端,真实的请求发起方: UserServer:内网穿透-用户 ...

  3. JMeter进行压力测试时查看服务器的资源使用

    用户想要使用Jmeter监控所测试的服务器的资源使用情况,需要有Jmeter客户端插件和服务端插件 1.客户端插件 下载地址:https://jmeter-plugins.org/install/In ...

  4. css 马赛克悬停效果

    css 马赛克悬停效果 <!DOCTYPE html> <html lang="en"> <head> <meta charset=

  5. fabric运行记录

    创建第一个fabric网络 Generate Network Artifacts cd first-network 先关闭服务 ./byfn.sh -m down 然后创建 ./byfn.sh -m ...

  6. tabulate

    ValueError: headers for a list of dicts is not a dict or a keyword from: https://bitbucket.org/astan ...

  7. Java学习(二十二)

    学了一个在css中叫font的样式: 感觉还是挺好用的 不过要注意如果把font放在最后,其他会使用默认值,可能会覆盖掉前面的 例如新学的行高 在font中语法是 font:30px/40px &qu ...

  8. python tkinter实现俄罗斯方块 基础版

    本项目最终效果见本人b站投稿av81480858 简介部分 本项目最终代码已上传github: https://github.com/BigShuang/Tetris 的1_BASIC文件夹 .其中1 ...

  9. 【死磕 NIO】— 深入分析Buffer

    大家好,我是大明哥,今天我们来看看 Buffer. 上面几篇文章详细介绍了 IO 相关的一些基本概念,如阻塞.非阻塞.同步.异步的区别,Reactor 模式.Proactor 模式.以下是这几篇文章的 ...

  10. 网络安全协议之IPsec

    声明 本文仅发表在博客园,作者LightningStar. 简介[1] IPSec(Internet 协议安全)是一个工业标准网络安全协议,工作在OSI模型的第三层,即网络层,为IP网络通信提供透明的 ...