UnicodeEncode error when calling mackup backup
I'm trying to call mackup backup and I get the following error:
File "/usr/local/Cellar/mackup/0.8.11/libexec/bin/mackup", line 9, in <module>
load_entry_point('mackup==0.8.11', 'console_scripts', 'mackup')()
File "/usr/local/Cellar/mackup/0.8.11/libexec/lib/python2.7/site-packages/mackup/main.py", line 65, in main
app_db = ApplicationsDatabase()
File "/usr/local/Cellar/mackup/0.8.11/libexec/lib/python2.7/site-packages/mackup/appsdb.py", line 34, in __init__
if config.read(config_file):
File "/Library/Python/2.7/site-packages/configparser.py", line 709, in read
self._read(fp, filename)
File "/Library/Python/2.7/site-packages/configparser.py", line 1124, in _read
optname = self.optionxform(optname.rstrip())
UnicodeEncodeError: 'ascii' codec can't encode character u'\xdc' in position 28: ordinal not in range(128)
I installed mackup via brew and I am running python 2.7.11. This error also came up with python 2.6
Yeah, I get this on python 3.5 too, installed mackup via pip. For me however, it work via homebrew. Hmm.
To be clear, the error in python3.5 is different:
Traceback` (most recent call last):
File "/usr/local/bin/mackup", line 9, in <module>
load_entry_point('mackup==0.8.12', 'console_scripts', 'mackup')()
File "/Users/dan/Source/mackup/mackup/main.py", line 64, in main
mckp = Mackup()
File "/Users/dan/Source/mackup/mackup/mackup.py", line 24, in __init__
self._config = config.Config()
File "/Users/dan/Source/mackup/mackup/config.py", line 52, in __init__
self._path = self._parse_path()
File "/Users/dan/Source/mackup/mackup/config.py", line 223, in _parse_path
if sys.version_info[0] < 3:
AttributeError: 'str' object has no attribute 'decode'
In python2.7 the error is thrown when parsing applications/ubersicht.cfg
where the line Library/Application Support/Übersicht/widgets has a non-ascii character.
I have this error also:
Traceback (most recent call last):
File "/usr/bin/mackup", line 9, in <module>
load_entry_point('mackup==0.8.12', 'console_scripts', 'mackup')()
File "/usr/lib/python3.5/site-packages/mackup/main.py", line 64, in main
mckp = Mackup()
File "/usr/lib/python3.5/site-packages/mackup/mackup.py", line 24, in __init__
self._config = config.Config()
File "/usr/lib/python3.5/site-packages/mackup/config.py", line 52, in __init__
self._path = self._parse_path()
File "/usr/lib/python3.5/site-packages/mackup/config.py", line 225, in _parse_path
path = path.decode("utf-8")
AttributeError: 'str' object has no attribute 'decode'
me too
$ mackup backup
Traceback (most recent call last):
File "/usr/local/bin/mackup", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/mackup/main.py", line 64, in main
mckp = Mackup()
File "/usr/local/lib/python3.5/dist-packages/mackup/mackup.py", line 24, in __init__
self._config = config.Config()
File "/usr/local/lib/python3.5/dist-packages/mackup/config.py", line 52, in __init__
self._path = self._parse_path()
File "/usr/local/lib/python3.5/dist-packages/mackup/config.py", line 225, in _parse_path
path = path.decode("utf-8")
AttributeError: 'str' object has no attribute 'decode'
any news on this same thing ubuntu 16.04 installed via pip Python 2.7.11+
mackup backup
Traceback (most recent call last):
File "/usr/local/bin/mackup", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/mackup/main.py", line 65, in main
app_db = ApplicationsDatabase()
File "/usr/local/lib/python2.7/dist-packages/mackup/appsdb.py", line 34, in __init__
if config.read(config_file):
File "/usr/local/lib/python2.7/dist-packages/configparser.py", line 709, in read
self._read(fp, filename)
File "/usr/local/lib/python2.7/dist-packages/configparser.py", line 1124, in _read
optname = self.optionxform(optname.rstrip())
UnicodeEncodeError: 'ascii' codec can't encode character u'\xdc' in position 28: ordinal not in range(128)
Yep. +1 on this for me as well making mackup a scary proposition right now. Not sure what to do about it. LOL. I feel like my configs are now hostages.
Ok, so I managed to work around it. I uninstalled mackup with Brew. Then used pip3 to install it. NOT pip (same error if using pip). So I dunno... your mileage WILL vary. Good luck.
In /usr/local/lib/python2.7/dist-packages/backports/configparser/__init__.py, I changed this line optname = self.optionxform(optname.rstrip()) to optname = self.optionxform(optname.encode('utf-8').rstrip()) and the problem is solved.
I solved this by removing the utf-8 decoding of the path in mackup/config.py
<delete>
224: else:
225: path = path.decode("utf-8")
</delete>
Had this problem on Linux after installing using pip. No problems if installed using pip3