Skip to content

UnicodeDecodeError when running pre-commit on Windows with v2.3.0 #294

Closed
@sgbaird

Description

autoflake................................................................Failed
- hook id: autoflake
- exit code: 1

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\sterg\.cache\pre-commit\repop8j70l5p\py_env-default\Scripts\autoflake.EXE\__main__.py", line 7, in <module>
  File "C:\Users\sterg\.cache\pre-commit\repop8j70l5p\py_env-default\Lib\site-packages\autoflake.py", line 1599, in main
    return _main(
           ^^^^^^
  File "C:\Users\sterg\.cache\pre-commit\repop8j70l5p\py_env-default\Lib\site-packages\autoflake.py", line 1513, in _main
    args, success = merge_configuration_file(args)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\sterg\.cache\pre-commit\repop8j70l5p\py_env-default\Lib\site-packages\autoflake.py", line 1275, in merge_configuration_file
    config = find_and_process_config(flag_args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\sterg\.cache\pre-commit\repop8j70l5p\py_env-default\Lib\site-packages\autoflake.py", line 1234, in find_and_process_config
    config = processor(config_file_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\sterg\.cache\pre-commit\repop8j70l5p\py_env-default\Lib\site-packages\autoflake.py", line 1211, in process_config_file
    reader.read(config_file_path)
  File "C:\Users\sterg\miniforge3\envs\honegumi\Lib\configparser.py", line 713, in read
    self._read(fp, filename)
  File "C:\Users\sterg\miniforge3\envs\honegumi\Lib\configparser.py", line 1036, in _read
    for lineno, line in enumerate(fp, start=1):
  File "C:\Users\sterg\miniforge3\envs\honegumi\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 295: character maps to <undefined>

For now I'm just disabling the hook instead of trying to debug further (already tried with new environments).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions