Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何解决解码错误的问题? #109

Open
popeyesheng opened this issue Mar 8, 2023 · 2 comments
Open

如何解决解码错误的问题? #109

popeyesheng opened this issue Mar 8, 2023 · 2 comments

Comments

@popeyesheng
Copy link

Traceback (most recent call last):
File "binlog2sql.py", line 150, in
binlog2sql.process_binlog()
File "binlog2sql.py", line 74, in process_binlog
for binlog_event in stream:
File "/usr/local/lib/python3.6/site-packages/pymysqlreplication/binlogstream.py", line 432, in fetchone
self.__fail_on_table_metadata_unavailable)
File "/usr/local/lib/python3.6/site-packages/pymysqlreplication/packet.py", line 139, in init
fail_on_table_metadata_unavailable=fail_on_table_metadata_unavailable)
File "/usr/local/lib/python3.6/site-packages/pymysqlreplication/event.py", line 175, in init
- self.schema_length - 1).decode("utf-8")

@v587xpt
Copy link

v587xpt commented May 17, 2023

在使用 -B 转为恢复sql时,也遇到了编码的问题,请问您解决了吗?
Traceback (most recent call last): File "binlog2sql.py", line 150, in <module> binlog2sql.process_binlog() File "binlog2sql.py", line 121, in process_binlog self.print_rollback_sql(filename=tmp_file) File "binlog2sql.py", line 129, in print_rollback_sql for line in reversed_lines(f_tmp): File "/home/system_tool/binlog_recover/binlog2sql/binlog2sql/binlog2sql_util.py", line 249, in reversed_lines block = block.decode("utf-8") UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte

@v587xpt
Copy link

v587xpt commented May 17, 2023

已经解决了;
修改 binlog2sql_util.py 第249行:block = block.decode("utf-8", 'ignore');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants