%b requires a bytes-like object, or an object that implements __bytes__, not 'str' #388
Unanswered
BetuelDerman
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey I was testing the script (https://github.com/newren/git-filter-repo/blob/main/t/t9391/commit_info.py) from newren on my own commits but everytime it stucks and gives the error:
file_.write(b'data %d\n%s%s' %
TypeError: %b requires a bytes-like object, or an object that implements bytes, not 'str'
fatal: Expected 'data n' command, found:
Is there any solution to it?
Thanks!
This is the script
#!/usr/bin/env python3
"""
Please see the
***** API BACKWARD COMPATIBILITY CAVEAT *****
near the top of git-filter-repo
"""
import re
import datetime
import git_filter_repo as fr
def change_up_them_commits(commit, metadata):
Change the commit author
if commit.author_name == b"Copy N. Paste":
commit.author_name = b"Ima L. Oser"
commit.author_email = b"[email protected]"
Fix the author email
commit.author_email = re.sub(b"@my.crp", b"@my.corp", commit.author_email)
Fix the committer date (bad timezone conversion in initial import)
oldtime = fr.string_to_date(commit.committer_date)
newtime = oldtime + datetime.timedelta(hours=-5)
commit.committer_date = fr.date_to_string(newtime)
Fix the commit message
commit.message = re.sub(b"Marketing is staffed with pansies", b"",
commit.message)
args = fr.FilteringOptions.parse_args(['--force'])
filter = fr.RepoFilter(args, commit_callback = change_up_them_commits)
filter.run()
Beta Was this translation helpful? Give feedback.
All reactions