Open raiscra opened 3 years ago
Thank you for digging into it @phyhac. I've created a PR with the fix. #985
我也遇到这个问题 看到你的贴子. 删除~/myclirc 文件后恢复正常工作了
@omaidb Open up your myclirc file located at C:\Users\qiaofei\.myclirc
and delete the dash character in line 63 and 64 between the characters 0-23
and 1-12
.
That should fix the issue.
# \R - The current time, in 24-hour military time (0-23)
# \r - The current time, standard 12-hour time (1-12)
This is still an issue, it took me 2 hours to figure this out, and of course I could not trace this back on my own, so big props to phyhac and of cource google. The twist in the story was that I use asdf for managing python versions, and it does not use the .myclirc from the home folder but another one from its own .asdf directory. I also has to mention that I run mycli from wsl on ubuntu 20.04.
I got a UnicodeDecodeError when I used mycli, and then I solved it by changing a strange note "–" which differs from "-" in the comment of .myclirc. Maybe it is a small bug?
What is the Problem?
mycli Version: 1.24.1, in Windows 10. I ran
mycli
in python 3.8.5, and then it came up with this error:Traceback (most recent call last): File "c:\users\laish\anaconda3\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\laish\anaconda3\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\laish\Anaconda3\Scripts\mycli.exe__main.py", line 7, in
File "c:\users\laish\anaconda3\lib\site-packages\click\core.py", line 829, in call
return self.main(args, kwargs)
File "c:\users\laish\anaconda3\lib\site-packages\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "c:\users\laish\anaconda3\lib\site-packages\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, ctx.params)
File "c:\users\laish\anaconda3\lib\site-packages\click\core.py", line 610, in invoke
return callback(args, **kwargs)
File "c:\users\laish\anaconda3\lib\site-packages\mycli\main.py", line 1160, in cli
mycli = MyCli(prompt=prompt, logfile=logfile,
File "c:\users\laish\anaconda3\lib\site-packages\mycli\main.py", line 136, in init__
c = self.config = read_config_files(config_files)
File "c:\users\laish\anaconda3\lib\site-packages\mycli\config.py", line 105, in read_config_files
_config = read_config_file(_file, list_values=list_values)
File "c:\users\laish\anaconda3\lib\site-packages\mycli\config.py", line 52, in read_config_file
config = ConfigObj(f, interpolation=False, encoding='utf8',
File "c:\users\laish\anaconda3\lib\site-packages\configobj.py", line 1229, in init
File "c:\users\laish\anaconda3\lib\site-packages\configobj.py", line 1287, in _load
content = self._handle_bom(content)
File "c:\users\laish\anaconda3\lib\site-packages\configobj.py", line 1437, in _handle_bom
return self._decode(infile, self.encoding)
File "c:\users\laish\anaconda3\lib\site-packages\configobj.py", line 1517, in _decode
infile[i] = line.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa8 in position 52: invalid start byte
I tracked the error and it was from the configobj.py:
infile[i] = line.decode(encoding)
. There was something wrong this string...How I solve it
I found the string of variable 'line' was from .myclirc. In this file, the notes in the end of two lines here counldn't be recognized correctly:
# \R - The current time, in 24-hour military time (0–23) # \r - The current time, standard 12-hour time (1–12)
So I changed the two notes. Now mycli can run.