环境与前提
- 系统:macOS 10.13.6 (17G65)
- Python2.7 和 3.7 并存
- 通过 Homebrew 安装的 Mackup(ver 0.8.18)
报错内容
在终端中输入 mackup backup
后,报错如下
Traceback (most recent call last):
File "/usr/local/Cellar/mackup/0.8.18/libexec/bin/mackup", line 9, in <module>
load_entry_point('mackup==0.8.18', 'console_scripts', 'mackup')()
File "/usr/local/Cellar/mackup/0.8.18/libexec/lib/python2.7/site-packages/mackup/main.py", line 65, in main
app_db = ApplicationsDatabase()
File "/usr/local/Cellar/mackup/0.8.18/libexec/lib/python2.7/site-packages/mackup/appsdb.py", line 34, in __init__
if config.read(config_file):
File "/Users/ouyang/Library/Python/2.7/lib/python/site-packages/backports/configparser/__init__.py", line 705, in read
self._read(fp, filename)
File "/Users/ouyang/Library/Python/2.7/lib/python/site-packages/backports/configparser/__init__.py", line 1109, in _read
optname = self.optionxform(optname.rstrip())
UnicodeEncodeError: 'ascii' codec can't encode character u'\xdc' in position 28: ordinal not in range(128)
经过简单搜索,可以初步认定是因为 Python 版本兼容问题。
临时解决办法
参考来源:Problem right after installation #940
该文章中的解决办法是将 ubersicht.cfg
删除。为避免不可挽回的损失,我采取了下面的步骤和办法:
- 从终端进入
/usr/local/Cellar/mackup/0.8.18/libexec/lib/python2.7/site-packages/mackup/applications/
- 备份该文件
mv ubersicht.cfg ubersicht.cfg.bak
再次运行 mackup backup
后,可正常备份了。