jonhadfield / python-hosts

a hosts file manager library written in python
MIT License
125 stars 33 forks source link

No support while there is Chinese in hosts file #26

Closed Lutra-Fs closed 4 years ago

Lutra-Fs commented 4 years ago

If there is any comments written in Chinese, the module will throw an error.

Traceback (most recent call last): File "D:\456\akamTester\akamTester.py", line 113, in fastHosts = Hosts() File "%AppData%\Local\Programs\Python\Python37\lib\site-packages\python_hosts\hosts.py", line 144, in init self.populate_entries() File "%AppData%\Local\Programs\Python\Python37\lib\site-packages\python_hosts\hosts.py", line 433, in populate_entries hosts_entries = [line for line in hosts_file] File "%AppData%\Local\Programs\Python\Python37\lib\site-packages\python_hosts\hosts.py", line 433, in hosts_entries = [line for line in hosts_file] UnicodeDecodeError: 'gbk' codec can't decode byte 0xbf in position 2: illegal multibyte sequence

Lutra-Fs commented 4 years ago

See https://github.com/jonhadfield/python-hosts/pull/27 BUT it has lost Python 2.x Support now

github-actions[bot] commented 4 years ago

Stale issue message