bndr / pipreqs

pipreqs - Generate pip requirements.txt file based on imports of any project. Looking for maintainers to move this project forward.
Apache License 2.0
6.38k stars 388 forks source link

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

Closed code4happylife closed 10 months ago

code4happylife commented 2 years ago

After I run


pipreqs . 

I got errors like below:

File "C:\Users\myname\AppData\Local\Programs\Python\Python310\lib\site-packages\pipreqs\pipreqs.py", line 115, in get_all_imports contents = f.read()

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

ConyKitty commented 2 years ago

Try to add the parameter --encoding with UTF-8:

pipreqs . --encoding UTF-8

alan-barzilay commented 10 months ago

fixed in #414