Error when invoking pipreqs in a newly created VENV. UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 224: character maps to <undefined>
- Dominant language
- Python
- Stars
- 7.5k
- Forks
- 424
- PR merge metrics
- No merged PRs in 30d
Description
Version of Python being used is `Python 3.10.11`
Result of `pip list` in the venv.
```
Package Version
------------------ -----------
afdko 4.0.0
appdirs 1.4.4
booleanOperations 0.9.0
Brotli 1.1.0
cchardet 2.1.7
certifi 2023.11.17
cffsubr 0.2.9.post1
chardet 5.2.0
charset-normalizer 3.3.2
click 8.1.7
colorama 0.4.6
commandlines 0.4.1
contourpy 1.2.0
cycler 0.12.1
defcon 0.10.3
dehinter 4.0.0
docopt 0.6.2
filetype 1.2.0
fleep 1.0.1
font-line 3.1.4
font-rename 0.2.0
font-v 2.1.0
fontMath 0.9.3
fontmeta 1.6.1
fontParts 0.12.1
fontPens 0.2.4
fonttools 4.47.0
foundrytools-cli 1.1.5
freetype-py 2.4.0
fs 2.4.16
gitdb 4.0.11
GitPython 3.1.40
idna 3.6
ImageHash 4.3.1
kiwisolver 1.4.5
loguru 0.7.2
lxml 4.9.4
markdown-it-py 3.0.0
matplotlib 3.8.2
mdurl 0.1.2
MutatorMath 3.0.1
numpy 1.26.2
opentypesvg 1.1.5
packaging 23.2
pathvalidate 3.2.0
Pillow 10.1.0
pip 23.3.2
pipreqs 0.4.13
psautohint 2.4.0
pycairo 1.25.1
pyclipper 1.3.0.post5
PyFontConverter 1.0.2
Pygments 2.17.2
pyparsing 3.1.1
PyQt5 5.15.10
PyQt5-Qt5 5.15.2
PyQt5-sip 12.13.0
python-dateutil 2.8.2
python-fontbro 0.17.2
python-fsutil 0.13.0
PyWavelets 1.5.0
reportlab 4.0.8
requests 2.31.0
rich 13.7.0
scipy 1.11.4
setuptools 65.5.0
six 1.16.0
skia-pathops 0.8.0.post1
smmap 5.0.1
standardstreams 0.2.0
tqdm 4.66.1
ttfautohint-py 0.5.1
ufonormalizer 0.6.1
ufoProcessor 1.9.0
uharfbuzz 0.38.0
unicodedata2 15.1.0
urllib3 2.1.0
win32-setctime 1.1.0
yarg 0.1.9
zopfli 0.2.3
```
Running `pipreqs .` in the `python\FontTools` venv results in the following:
```
Traceback (most recent call last):
File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "D:\Dev\Powershell\VSYSModules\VSYSFontOps\python\FontTools\Scripts\pipreqs.exe\__main__.py", line 7, in
File "D:\Dev\Powershell\VSYSModules\VSYSFontOps\python\FontTools\lib\site-packages\pipreqs\pipreqs.py", line 528, in main
init(args)
File "D:\Dev\Powershell\VSYSModules\VSYSFontOps\python\FontTools\lib\site-packages\pipreqs\pipreqs.py", line 455, in init
candidates = get_all_imports(input_path,
File "D:\Dev\Powershell\VSYSModules\VSYSFontOps\python\FontTools\lib\site-packages\pipreqs\pipreqs.py", line 115, in get_all_imports
contents = f.read()
File "C:\Users\username\AppData\Local\Programs\Python\Python310\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 0x90 in position 224: character maps to
```
Can someone please help me fix this?
Contributor guide
Research direction
Reproduce `pipreqs .` in the reported Python 3.10.11 virtual environment, then inspect pipreqs.py around get_all_imports and line 115 where the file is read. Done means the command processes the project without the reported UnicodeDecodeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100