mycli
mycli copied to clipboard
Is there a encoding bug in the .myclirc ?
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
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.
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.