pipreqs icon indicating copy to clipboard operation
pipreqs copied to clipboard

Errors occured when rusing the 'pipreqs' command

Open mingjun1120 opened this issue 3 years ago • 5 comments

(lastFYP_venv) PS C:\Users\Jun\Desktop\Last_FYP> pipreqs

Traceback (most recent call last):
  File "C:\Users\Jun\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Jun\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Jun\Desktop\Last_FYP\lastFYP_venv\Scripts\pipreqs.exe\__main__.py", line 7, in <module>
  File "c:\users\jun\desktop\last_fyp\lastfyp_venv\lib\site-packages\pipreqs\pipreqs.py", line 488, in main
    init(args)
  File "c:\users\jun\desktop\last_fyp\lastfyp_venv\lib\site-packages\pipreqs\pipreqs.py", line 415, in init
    candidates = get_all_imports(input_path,
  File "c:\users\jun\desktop\last_fyp\lastfyp_venv\lib\site-packages\pipreqs\pipreqs.py", line 115, in get_all_imports
    contents = f.read()
  File "C:\Users\Jun\AppData\Local\Programs\Python\Python39\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 454: character maps to <undefined>

mingjun1120 avatar Nov 16 '21 08:11 mingjun1120

Hi, I have that error now on multiple machines, too. I did not traceback yet, when it occurred the first time. I updated all packages, but it still occurs. All machines run under windows. But under Linux this is working.

PatrickGoettsch avatar Nov 17 '21 09:11 PatrickGoettsch

@mingjun1120 Please try add the flag --encoding=utf-8

kinlamleung avatar Nov 25 '21 08:11 kinlamleung

@kinlamleung Please try add the flag --encoding=utf-8 U mean type pipreqs --encoding=utf-8 in the terminal?

mingjun1120 avatar Nov 25 '21 10:11 mingjun1120

@mingjun1120 Please try add the flag --encoding=utf-8

Does not work!

mingjun1120 avatar Feb 11 '22 06:02 mingjun1120

Works for me, thanks.

quammy avatar Apr 18 '22 16:04 quammy