PySvn
PySvn copied to clipboard
function log_default throw an UnicodeDecodeError on Windows(Chinese)
Windows console default encoding is gbk.
Function log_default
can not specific an encoding type.
once I call svn_remote.log_default() to get a svn repo's log with encoding utf8, there will be an error.
Traceback (most recent call last):
File "D:/Proj/Python/myscript/module_svn.py", line 15, in <module>
main()
File "D:/Proj/Python/myscript/module_svn.py", line 10, in main
print(next(svn_remote.log_default()))
File "D:\Software\Python37\lib\site-packages\svn\common.py", line 251, in log_default
do_combine=True)
File "D:\Software\Python37\lib\site-packages\svn\common.py", line 60, in run_command
return self.external_command(cmd, environment=self.__env, **kwargs)
File "D:\Software\Python37\lib\site-packages\svn\common_base.py", line 29, in external_command
universal_newlines=decode_text)
File "D:\Software\Python37\lib\subprocess.py", line 376, in check_output
**kwargs).stdout
File "D:\Software\Python37\lib\subprocess.py", line 455, in run
stdout, stderr = process.communicate(input, timeout=timeout)
File "D:\Software\Python37\lib\subprocess.py", line 907, in communicate
stdout = self.stdout.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 170: illegal multibyte sequence
Process finished with exit code 1
I add an argument to function external_command
, class CommonBase
, in common_base.py, this problem has been solved.
can author do some optimization?
I add an argument to function
external_command
, classCommonBase
, in common_base.py, this problem has been solved. can author do some optimization?
hi,could you share your scripts? I've faced the same problem.
I add an argument to function
external_command
, classCommonBase
, in common_base.py, this problem has been solved. can author do some optimization?hi,could you share your scripts? I've faced the same problem.
I solved it when add an argument encoding="utf-8" to subprocess.check_output in function external_command in common_base.py.
I used python 3.10.5 on window10