rpl 错误“TypeError:encode() 参数 1 必须是 str,而不是 None”

rpl 错误“TypeError:encode() 参数 1 必须是 str,而不是 None”

也许我应该使用不同的工具,但 rpl 一直像这样为我工作......

rpl -Ris "oldname.com" "newname.com" *

(如果您想知道,R = 递归,i = 忽略大小写,s = 空运行模拟)

错误是...

The files listed below would be modified in a replace operation.
Traceback (most recent call last):
  File "/usr/bin/rpl", line 314, in <module>
main()
  File "/usr/bin/rpl", line 246, in main
matches = blockrepl(f, o, regex, old_str, new_str, 1024)
  File "/usr/bin/rpl", line 92, in blockrepl
parts = (after.join(parts)).encode(encoding=encoding, errors='ignore')
TypeError: encode() argument 1 must be str, not None

答案1

语言环境库无法找到默认语言环境,因此失败。可以通过设置LANG环境变量来设置默认区域设置(例如export LANG=en_US.utf-8.

相关内容