bndr / bndr/pipreqs

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 8033: character maps to <undefined>

Open
#376 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

I encountered this error message when trying to use your package

(DeepECGI) C:\Users\Surface>pipreqs C:\Users\Surface\OneDrive\Documents\MATLAB\DeepECGImaging
Traceback (most recent call last):
File "C:\Users\Surface\anaconda3\envs\DeepECGI\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Surface\anaconda3\envs\DeepECGI\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\Surface\anaconda3\envs\DeepECGI\Scripts\pipreqs.exe\__main__.py", line 7, in
File "C:\Users\Surface\anaconda3\envs\DeepECGI\lib\site-packages\pipreqs\pipreqs.py", line 528, in main
init(args)
File "C:\Users\Surface\anaconda3\envs\DeepECGI\lib\site-packages\pipreqs\pipreqs.py", line 455, in init
candidates = get_all_imports(input_path,
File "C:\Users\Surface\anaconda3\envs\DeepECGI\lib\site-packages\pipreqs\pipreqs.py", line 115, in get_all_imports
contents = f.read()
File "C:\Users\Surface\anaconda3\envs\DeepECGI\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 8033: character maps to

Python 3.8.16

Windows 11

Contributor guide

Open the contributing guide

Research direction

Start at pipreqs.py, especially init and get_all_imports, where the traceback reaches f.read(). Reproduce the command on Windows with the reported project and inspect how its source files are opened. Done means the reported non-UTF-8 input no longer produces an unhandled UnicodeDecodeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.