bndr / bndr/pipreqs

UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 615: illegal multibyte sequence

Open
#387 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.5k
Forks
424
PR merge metrics
No merged PRs in 30d

Description

When I execute `pipreqs myapp` command ,it tips error:
```
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "D:\ProgramData\Anaconda3\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\workspace\cube-studio\venv\Scripts\pipreqs.exe\__main__.py", line 7, in
File "D:\ProgramData\Anaconda3\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\workspace\cube-studio\venv\Scripts\pipreqs.exe\__main__.py", line 7, in
File "D:\workspace\cube-studio\venv\lib\site-packages\pipreqs\pipreqs.py", line 528, in main
init(args)
File "D:\workspace\cube-studio\venv\lib\site-packages\pipreqs\pipreqs.py", line 455, in init
candidates = get_all_imports(input_path,
File "D:\workspace\cube-studio\venv\lib\site-packages\pipreqs\pipreqs.py", line 115, in get_all_imports
contents = f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 615: illegal multibyte sequence

```

Contributor guide

Open the contributing guide

Research direction

Start with pipreqs.py at line 115, where get_all_imports reads source files after the pipreqs myapp command. Reproduce the reported Windows encoding failure with the provided traceback, then verify that the command handles the affected file without raising UnicodeDecodeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.