repo失败的修改

最近电脑硬盘出了问题,重装了一次系统。又去搭建了一次环境,记录下搭建环境的问题

在执行 repo 初始化的时候遇到了这个问题:

Traceback (most recent call last):
  File "/sd2/cc/.repo/repo/main.py", line 531, in <module>
    _Main(sys.argv[1:])
  File "/sd2/cc/.repo/repo/main.py", line 507, in _Main
    result = repo._Run(argv) or 0
  File "/sd2/cc/.repo/repo/main.py", line 180, in _Run
    result = cmd.Execute(copts, cargs)
  File "/sd2/cc/.repo/repo/subcmds/init.py", line 399, in Execute
    self._SyncManifest(opt)
  File "/sd2/cc/.repo/repo/subcmds/init.py", line 171, in _SyncManifest
    m._InitGitDir(mirror_git=mirrored_manifest_git)
  File "/sd2/cc/.repo/repo/project.py", line 2271, in _InitGitDir
    ref_dir = mp.config.GetString('repo.reference') or ''
  File "/sd2/cc/.repo/repo/git_config.py", line 131, in GetString
    v = self._cache[_key(name)]
  File "/sd2/cc/.repo/repo/git_config.py", line 248, in _cache
    self._cache_dict = self._Read()
  File "/sd2/cc/.repo/repo/git_config.py", line 254, in _Read
    d = self._ReadGit()
  File "/sd2/cc/.repo/repo/git_config.py", line 299, in _ReadGit
    for line in d.decode('utf-8').rstrip('\0').split('\0'):  # pylint: disable=W1401
AttributeError: 'str' object has no attribute 'decode'
vi /sd2/cc/.repo/repo/git_config.py + 299
/*注意看报错*/
for line in d.rstrip('\0').split('\0'):
改为
for line in d.decode('utf-8').rstrip('\0').split('\0'):

后面就可以了。我再后面再次下载代码的时候又出现了同样的错误。进去查看后发现已经修改了,于是我又把他重新改回来就ok了。我以前配置的时候没有出现这种情况,不知到是不是repo的版本适配问题

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

永不秃头的程序员

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值