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.12k stars 384 forks source link

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

Open frehburg opened 1 year ago

frehburg commented 1 year ago

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

ahmedoid commented 1 year ago

Related https://github.com/bndr/pipreqs/issues/214