Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError: 'gbk' codec can't decode byte 0xa1 in position 1340: illegal multibyte sequence #1767

Closed
YeKelvin opened this issue Jun 28, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@YeKelvin
Copy link

python 3.8
isort 5.9.1.
windows 10.
use in vscode.

e:\personal-project\xxx/.cache/virtualenvs/xxx-py3.8/Scripts/isort - --diff
cwd: e:\personal-project\qa-cloud\qa-cloud-backend\app\common\decorators
Error 2021-06-28 15:11:04: Traceback (most recent call last):
File "C:\Program Files\Python38\lib\runpy.py", line 194, in _run_module_as_main

Traceback (most recent call last):
File "C:\Program Files\Python38\lib\runpy.py", line 194, in _run_module_as_main

Error 2021-06-28 15:11:04: Failed to format imports for 'e:\personal-project\xxx\app\common\decorators\service.py'. Traceback (most recent call last):
File "C:\Program Files\Python38\lib\runpy.py", line 194, in _run_module_as_main

Error 2021-06-28 15:11:04: return _run_code(code, main_globals, None,
File "C:\Program Files\Python38\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "e:\personal-project\xxx.cache\virtualenvs\xxx-py3.8\Scripts\isort.exe_main
.py", line 7, in
File "e:\personal-project\xxx.cache\virtualenvs\xxx-py3.8\lib\site-packages\isort\main.py", line 1101, in main
api.sort_stream(
File "e:\personal-project\xxx.cache\virtualenvs\xxx-py3.8\lib\site-packages\isort\api.py", line 164, in sort_stream
changed = sort_stream(
File "e:\personal-project\xxx.cache\virtualenvs\xxx-py3.8\lib\site-packages\isort\api.py", line 209, in sort_stream
changed = core.process(
File "e:\personal-project\xxx.cache\virtualenvs\xxx-py3.8\lib\site-packages\isort\core.py", line 379, in process
parsed_content = parse.file_contents(import_section, config=config)
File "e:\personal-project\xxx.cache\virtualenvs\xxx-py3.8\lib\site-packages\isort\parse.py", line 437, in file_contents
placed_module = finder(import_from)
File "e:\personal-project\xxx.cache\virtualenvs\xxx-py3.8\lib\site-packages\isort\place.py", line 17, in module

Error 2021-06-28 15:11:04: return module_with_reason(name, config)[0]
File "e:\personal-project\xxx.cache\virtualenvs\xxx-py3.8\lib\site-packages\isort\place.py", line 27, in module_with_reason
or _src_path(name, config)
File "e:\personal-project\xxx.cache\virtualenvs\xxx-py3.8\lib\site-packages\isort\place.py", line 84, in _src_path

Error 2021-06-28 15:11:04: and _is_namespace_package(module_path, config.supported_extensions)
File "e:\personal-project\xxx.cache\virtualenvs\xxx-py3.8\lib\site-packages\isort\place.py", line 129, in _is_namespace_package
file_start = open_init_file.read(4096)
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa1 in position 1340: illegal multibyte sequence

@timothycrosley timothycrosley added the bug Something isn't working label Jul 1, 2021
@StarHeartHunt
Copy link

I'm also facing this issue.

Any update on this?

timothycrosley added a commit that referenced this issue Jul 8, 2021
Fix issue #1767: codec error in __init__ files without proper encodin…
@yitianlian
Copy link

I also facing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants