使用 Bitbucket 读取字节时出现 Protobuf 解码错误
Protobuf Decode Error when reading bytes from withing Bitbucket
我在 Windows 上有一个保存为字节的 protobuf 文件。
我是这样读的:
tlog = tlog_schema_pb2.TLog()
with open("tests/unittests/data/tlog.proto", "rb") as f:
tlog.ParseFromString(f.read())
一切都很好。但是当我将 git 的更改推送到 Bitbucket 时,出现错误:
google.protobuf.message.DecodeError: Error parsing message with type 'globusdigital.tlogprocessing.TLog'
我不明白那是什么。当我推送到 Bitbucket 时会发生什么变化?
看来问题出在预提交中。
我在那里检查了尾随空格,它正在破坏 protobuf 文件。
要解决它,只需添加
files: '\.pyi?$'
在 .pre-commit-config.yaml
的末尾(排除文件会很酷,但不明白如何)
我在 Windows 上有一个保存为字节的 protobuf 文件。 我是这样读的:
tlog = tlog_schema_pb2.TLog()
with open("tests/unittests/data/tlog.proto", "rb") as f:
tlog.ParseFromString(f.read())
一切都很好。但是当我将 git 的更改推送到 Bitbucket 时,出现错误:
google.protobuf.message.DecodeError: Error parsing message with type 'globusdigital.tlogprocessing.TLog'
我不明白那是什么。当我推送到 Bitbucket 时会发生什么变化?
看来问题出在预提交中。 我在那里检查了尾随空格,它正在破坏 protobuf 文件。
要解决它,只需添加
files: '\.pyi?$'
在 .pre-commit-config.yaml
的末尾(排除文件会很酷,但不明白如何)