dbcli / mycli

A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting.
http://mycli.net
Other
11.5k stars 664 forks source link

'utf-8' codec can't decode byte 0x96 in position 52 #993

Closed Rafiquzzaman420 closed 3 years ago

Rafiquzzaman420 commented 3 years ago

Hey! I'm on a windows machine. I installed mycli today with pip. But when I run this command: C:\Users\rafiq>mycli -u root I get this error: Traceback (most recent call last): File "c:\users\rafiq\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\rafiq\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\rafiq\AppData\Local\Programs\Python\Python39\Scripts\mycli.exe\__main__.py", line 7, in <module> File "c:\users\rafiq\appdata\local\programs\python\python39\lib\site-packages\click\core.py", line 1137, in __call__ return self.main(*args, **kwargs) File "c:\users\rafiq\appdata\local\programs\python\python39\lib\site-packages\click\core.py", line 1062, in main rv = self.invoke(ctx) File "c:\users\rafiq\appdata\local\programs\python\python39\lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "c:\users\rafiq\appdata\local\programs\python\python39\lib\site-packages\click\core.py", line 763, in invoke return __callback(*args, **kwargs) File "c:\users\rafiq\appdata\local\programs\python\python39\lib\site-packages\mycli\main.py", line 1160, in cli mycli = MyCli(prompt=prompt, logfile=logfile, File "c:\users\rafiq\appdata\local\programs\python\python39\lib\site-packages\mycli\main.py", line 136, in __init__ c = self.config = read_config_files(config_files) File "c:\users\rafiq\appdata\local\programs\python\python39\lib\site-packages\mycli\config.py", line 105, in read_config_files _config = read_config_file(_file, list_values=list_values) File "c:\users\rafiq\appdata\local\programs\python\python39\lib\site-packages\mycli\config.py", line 52, in read_config_file config = ConfigObj(f, interpolation=False, encoding='utf8', File "c:\users\rafiq\appdata\local\programs\python\python39\lib\site-packages\configobj.py", line 1229, in __init__ self._load(infile, configspec) File "c:\users\rafiq\appdata\local\programs\python\python39\lib\site-packages\configobj.py", line 1287, in _load content = self._handle_bom(content) File "c:\users\rafiq\appdata\local\programs\python\python39\lib\site-packages\configobj.py", line 1437, in _handle_bom return self._decode(infile, self.encoding) File "c:\users\rafiq\appdata\local\programs\python\python39\lib\site-packages\configobj.py", line 1517, in _decode infile[i] = line.decode(encoding) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 52: invalid start byte

Please help me out :(

Rafiquzzaman420 commented 3 years ago

This repository owner or anyone has no response. So I decided to just close this issue 👎

vtibix commented 3 years ago

I have the same issue here. Mycli worked as expected yesterday, today it fails to start with the exact same error message. Python is installed with asdf version manager and runs on wsl ubuntu 20.04. This is what I get when I run mycli:

File "/home/vtibi/.asdf/installs/python/3.9.6/bin/mycli", line 8, in sys.exit(cli()) File "/home/vtibi/.asdf/installs/python/3.9.6/lib/python3.9/site-packages/click/core.py", line 1137, in call return self.main(args, kwargs) File "/home/vtibi/.asdf/installs/python/3.9.6/lib/python3.9/site-packages/click/core.py", line 1062, in main rv = self.invoke(ctx) File "/home/vtibi/.asdf/installs/python/3.9.6/lib/python3.9/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/vtibi/.asdf/installs/python/3.9.6/lib/python3.9/site-packages/click/core.py", line 763, in invoke return __callback(args, **kwargs) File "/home/vtibi/.asdf/installs/python/3.9.6/lib/python3.9/site-packages/mycli/main.py", line 1160, in cli mycli = MyCli(prompt=prompt, logfile=logfile, File "/home/vtibi/.asdf/installs/python/3.9.6/lib/python3.9/site-packages/mycli/main.py", line 136, in init c = self.config = read_config_files(config_files) File "/home/vtibi/.asdf/installs/python/3.9.6/lib/python3.9/site-packages/mycli/config.py", line 105, in read_config_files _config = read_config_file(_file, list_values=list_values) File "/home/vtibi/.asdf/installs/python/3.9.6/lib/python3.9/site-packages/mycli/config.py", line 52, in read_config_file config = ConfigObj(f, interpolation=False, encoding='utf8', File "/home/vtibi/.asdf/installs/python/3.9.6/lib/python3.9/site-packages/configobj.py", line 1229, in init self._load(infile, configspec) File "/home/vtibi/.asdf/installs/python/3.9.6/lib/python3.9/site-packages/configobj.py", line 1287, in _load content = self._handle_bom(content) File "/home/vtibi/.asdf/installs/python/3.9.6/lib/python3.9/site-packages/configobj.py", line 1437, in _handle_bom return self._decode(infile, self.encoding) File "/home/vtibi/.asdf/installs/python/3.9.6/lib/python3.9/site-packages/configobj.py", line 1517, in _decode infile[i] = line.decode(encoding) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 52: invalid start byte

amjith commented 3 years ago

The mycli config file has a weird dash character that was added in a comment. This is causing issues in window.

You can fix this by editing your mycli config file line 63 and 64 https://www.mycli.net/config

https://github.com/dbcli/mycli/commit/d62eefdc819a11ecdb97d93dd7ad1922d28a3795

That should fix your startup issue.